Home » C Programming » C-Library-Functions » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    char num[25];
    fgets(num, 24, stdin);
    ungetc(num[0], stdin);
    scanf("%s", num);
    printf("%s\n", num);
    return 0;
    }
    1. First character of whatever user types first time and whatever user types second time
    2. Whatever string user types first time
    3. Whatever string user types second time
    4. Compilation Error
    5. None of these
Correct Option: A

First character of whatever user types first time and whatever user types second time



Your comments will be displayed only after manual approval.