C-Library-Functions
- ungetc() may be used with ________
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
All of above
- Only _____character of pushback is guaranteed per file when ungetc is used.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Zero
- 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
- What will be the output of the following C code considering user typed ajit?
#include <stdio.h>
int main()
{
char num[26];
fgets(num, 25, stdin);
ungetc(num[0], stdin);
printf("%s\n", num);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
ajit
- 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