Home » C Programming » Library Functions

What will be the output of the program? #include int main() { int i; i = scanf("%d %d", &i, &i); printf("%d\n", i); return 0; }

Correct Answer: 2

Explanation:

scanf() returns the number of variables to which you are provding the input. i = scanf("%d %d", &i, &i); Here Scanf() returns 2. So i = 2.


printf("%d\n", i); Here it prints 2.


← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion