Consider the following C program:
#include <stdio.h>
void fX();
int main(){
fX();
return 0;}void fX(){
char a;
if((a=getchar()) != '\n')
fX();
if(a != '\n')
putchar(a);}Assume that the input to the program from the command line is 1234 followed by a newline character. Which one of the following statements is CORRECT?
Tap to open full sizeFigure description
The question shows two side-by-side C code panels separated by a vertical divider line (a typical two-column print layout for a short program, not a diagram). Left panel: #include <stdio.h>; void fX(); int main() fX(); return 0;. Right panel: void fX() char a; if((a=getchar()) != ' ') fX(); if(a != ' ') putchar(a);. Below both panels, on the full page width, is the input assumption sentence, then the four MCQ options.
- (A)
The program will not terminate
- (B)
The program will terminate with no output
- (C)
The program will terminate with
4321as output - (D)
The program will terminate with
1234as output