Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C Programming
»
Library Functions
What will be the output of the program? #include<stdio.h> int main() { int i; i = scanf("%d %d", &i, &i); printf("%d\n", i); return 0; }
1
2
Garbage value
Error: cannot assign scanf to variable
Show Answer
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
Next →
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment