C Programming :: File Input/Output - Discussion
Home > C Programming > File Input/Output > MCQs Questions Discussion
2 / 12
Choose the correct option.
If the content of a file (input) is abc def. What will be the value of input and ch?.
#include
char input[100],ch;
void main(void)
{
FILE *fp;
fp = fopen("input","rb");
fscanf(fp, "%s" ,&input);
fscanf(fp, "%c" ,&ch);
printf("%s %c", input, ch);
}
char input[100],ch;
void main(void)
{
FILE *fp;
fp = fopen("input","rb");
fscanf(fp, "%s" ,&input);
fscanf(fp, "%c" ,&ch);
printf("%s %c", input, ch);
}
Aabc d
Babc def
Cabc
DNone of these
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
TRICK
It will not scan anything after a space is encountered.
Read Full Answer
Report Error
Please Login First Click Here