0

C program discussion how 2 came before 97

Plzz asap https://code.sololearn.com/cOh5hTPL1EJ7/?ref=app

11th Apr 2022, 1:23 AM
Jogender Singh
4 Respostas
+ 2
1. foo() is executed, hence 2 is printed (line 6) 2. The printf prints i which is 97. So the output is 297
11th Apr 2022, 7:20 AM
Lisa
Lisa - avatar
+ 2
Line 6: foo(&i); // prints 2 Line 8: printf("%d", *p); // prints 97 Output: 297
11th Apr 2022, 3:02 PM
Brian
Brian - avatar
+ 1
Because you invoke foo() at line 6. Number 2 was printed inside foo() at line 19. Number 97 was printed inside main() at line 8 You need to have a forward declaration of foo(), modern C compiler considers a invocation of foo to be inappropriate because foo() is defined after main() wherei foo() was invoked. Add this line in main at line 5 before foo is invoked at line 6 void foo( int* );
11th Apr 2022, 4:54 AM
Ipang
0
Brother I want to know how 2 is printed before 97 because the value print function is before is 97
11th Apr 2022, 7:04 AM
Jogender Singh