What is the output of the following program?and also tell why it is like that... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the output of the following program?and also tell why it is like that...

#include <stdio.h> int main() { int x ; printf("%d",scanf("%d",&x)); return 1; }

4th Apr 2020, 7:58 AM
SANKET DHENGRE
SANKET DHENGRE - avatar
1 Answer
+ 2
scanf() returns the number of arguments that were successfully assigned, so the output depends on whether the input is good or bad. https://en.cppreference.com/w/c/io/fscanf
4th Apr 2020, 9:08 AM
Shadow
Shadow - avatar