Bird
0
0

Which of the following is the correct syntax for prefix decrement of a variable x by 1 in C?

easy📝 Syntax Q12 of 15
C - Operators and Expressions
Which of the following is the correct syntax for prefix decrement of a variable x by 1 in C?
Ax--;
Bx-+;
Cx+-;
D--x;
Step-by-Step Solution
Solution:
  1. Step 1: Identify prefix decrement syntax

    The prefix decrement operator is --x;, which decrements x by 1.
  2. Step 2: Check options carefully

    A is postfix x--;, B x-+; and C x+-; invalid syntax, D is correct prefix.
  3. Final Answer:

    --x; -> Option D
  4. Quick Check:

    Prefix decrement --x; is correct syntax [OK]
Quick Trick: Look for correct -- syntax before or after variable [OK]
Common Mistakes:
  • Using invalid operators like -+ or +-
  • Confusing prefix and postfix syntax
  • Missing semicolon

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes