Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
C
« Previous
Next »
What is the purpose of getc() for?
Options
- read a character from any input stream
- read a character from a file
- both a and b above
CORRECT ANSWER : read a character from any input stream
Discussion Board
getc()-
-The correct answer is, both a and b above.
-getc() reads from any input stream i.e FILE stream or stdin.
-getchar() reads only from standard input stream i.e 'stdin'. As, you can use getc like getchar, using getc(stdin).
Syntax: int getc(FILE *stream);
e.g.
#include
int main()
{
printf("%c", getc(stdin));
return(0);
}
Sapna 02-15-2017 06:56 AM
read from stdin
correct answer is read character from stdin as user input first goes to stdin from there it will read
jb 07-15-2016 03:33 PM
getc() function.
Answer : read a character from file.
getc() returns a character from the specified FILE. The getc() function reads the next character (an unsigned char) from the specified stream and advances the position indicator for the stream.
Jayesh Sonar 02-24-2015 04:11 AM
correct answer
ans is read a character from STDIN.
STDIN is a file. a specified by OS. if you want to use other files, use fgetc() or change the file description of STDIN.
User input will be in STDIN file description.
Thus, the answer is STDIN
no 10-20-2014 06:22 AM
correct answer
ans is read a character from an input from user
naina 09-12-2014 07:25 AM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
C test (42)
C (12)
C++ for beginners (10)
C++ (20)
C++ (24)
C++ (18)
C++ (14)
C++ (12)
C++ (15)
C++ (15)
Data structure (20)
Data structure (10)
Data structure (10)
Data structure (10)
PERL (25)
VC++ (11)
Oops (30)
Mainframe (41)
Mainframe (15)
Embedded systems (15)
OOAD (49)
Advertisement
▲