1. Home
  2. Computer Science MCQs
  3. C Programming
  4. Why does getchar return a value of type int?

Added 30 Nov -0001

Why does getchar return a value of type int?

  1. To allow it to read wide characters
  2. To make it faster than putchar
  3. So that EOF can be told apart from data Correct answer
  4. Because characters are stored as int

Correct answer

C. So that EOF can be told apart from data

13 views

MCQSEXAM

Explanation

getchar returns an int so that the out-of-band value EOF cannot be mistaken for any real character.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C Programming MCQs

Practise all C Programming MCQs

Similar MCQs