Top

Discussion

What will be the output of the program?

#include

int main()
{
    int i;
    char c;
    for(i=1; i<=5; i++)
    {
        scanf("%c", &c); /* given input is 'a' */
        printf("%c", c);
        ungetc(c, stdin);
    }
    return 0;
}

 

  • A.aaaa
  • B.aaaaa
  • C.Garbage value.
  • D.Error in ungetc statement.

Answer: B

No answer description available for this question.

No comment is present. Be the first to comment.
Loading…

Post your comment