aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming - 2
  • What does the following C statement print? print(“%d”, ++5);
Multiple choice

What does the following C statement print? print(“%d”, ++5);

  1. 5

  2. 6

  3. 7

  4. An error message

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

The increment operator (++) requires an lvalue (a variable) to increment. Using it on a constant (5) is a syntax error.

Keep practicing — related questions

  • What does the statement printf(“%d”,10?0?5:11:12); print?
  • What would be the result of the following statement in C? printf(n %d,4%3)
  • Output of the following? printf("%d",-5/-4);
  • What would be the output of the following C statement? char ch; ch = 'A';ch = - ch + 'a'; printf(!!!^!!!ch ...
  • What will be the output of the following program : void main() { printf("%d %d %d",5,!5,25-!25); }
  • What gets printed? int i = 3; if (!i) i++; i++; if (i==3) i+=2; i+=2; printf("%d\n", i);
  • Consider the following C statement. int a = 3,b = 2; a+ = b++; printf(!!!^!!!a = %d!!!^!!!,a); What would b...
  • The following program prints main() { int i = 5; i = (++i) / (i ++); printf(“%d”,i); }
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy