C-Library-Functions
- 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;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
First character of whatever user types first time and whatever user types second time
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int num;
scanf("%d", &num);
ungetc(num, stdin);
scanf("%d", &num);
printf("%d\n", num);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Undefined behaviour
- Which character of pushback is guaranteed per file?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
True
- ungetc() can be used only with getc().
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
false
- What is the return type of rand() function?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
int