aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming - 2
  • The statement printf (“%d”, sizeof(“”)); prints
Multiple choice

The statement printf (“%d”, sizeof(“”)); prints

  1. an error message

  2. 0

  3. garbage

  4. 1

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The sizeof operator returns the size of the string literal, including the null terminator character ('\0'). An empty string "" contains only the null terminator, so its size is 1.

Keep practicing — related questions

  • void main() { printf("%d"t, sizeof(7.5)); printf("%d"t, sizeof(80000)); printf("%d"t, sizeof('B')); }. Whic...
  • What will be the output of the following set of codes after execution? void main() { printf(“%d”,sizeof(' '...
  • What will be the output of the following program : void main() { printf("%d",sizeof(integer)); }
  • What is the output ? main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }
  • Consider the following C statement. int a = 5; printf(a = %usizeof(a)); What would be the output of the abo...
  • Consider the declaration. int a = 5, *b = &a; printf(“%d”, a**b); prints
  • What is the output of the following code snippet ?? void main() { printf("%d", sizeof(2.0)); }
  • printf("%d",printf("What this will print"));
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy