Question
Comment on the output of this C code?   int main()   {       char c;       int i = 0;       FILE *file;       file = fopen("test.txt", "w+");       fprintf(file, "%c", 'a');       fprintf(file, "%c", -1);       fprintf(file, "%c", 'b');       fclose(file);       file = fopen("test.txt", "r");       while ((c = fgetc(file)) != -1)           printf("%c", c);       return 0;.   }
Answer: Option A
Was this answer helpful ?
None.
Output:
$ cc pgm3.c
$ a.out
a
Was this answer helpful ?
More Questions on This Topic :
Question 9. %f access specifier is used for? ....
Submit Solution