1. Home
  2. Computer Science MCQs
  3. C Programming
  4. For char s[] = "hello"; what does sizeof s evaluate to?

Added 30 Nov -0001

For char s[] = "hello"; what does sizeof s evaluate to?

  1. 7
  2. 4
  3. 6 Correct answer
  4. 5

Correct answer

C. 6

11 views

MCQSEXAM

Explanation

The array includes the terminating null character, so it occupies six bytes in total.

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