0
C program discussion how 2 came before 97
4 Réponses
+ 2
1. foo() is executed, hence 2 is printed (line 6)
2. The printf prints i which is 97.
So the output is 297
+ 2
Line 6: foo(&i); // prints 2
Line 8: printf("%d", *p); // prints 97
Output:
297
+ 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* );
0
Brother I want to know how 2 is printed before 97 because the value print function is before is 97