Bird
0
0

Which of the following is the correct way to declare a variable of type double in C?

easy📝 Syntax Q12 of 15
C - Variables and Data Types
Which of the following is the correct way to declare a variable of type double in C?
A<code>double num;</code>
B<code>double: num;</code>
C<code>num double;</code>
D<code>double-num;</code>
Step-by-Step Solution
Solution:
  1. Step 1: Recall C variable declaration syntax

    In C, the type comes first, then the variable name, ending with a semicolon.
  2. Step 2: Check each option for correct syntax

    double num; follows this rule: double num;. Others have invalid syntax like colon, reversed order, or invalid characters.
  3. Final Answer:

    double num; -> Option A
  4. Quick Check:

    Type before name, semicolon ends declaration [OK]
Quick Trick: Type first, then variable name, end with semicolon [OK]
Common Mistakes:
  • Using colon instead of semicolon
  • Reversing type and variable name
  • Using invalid characters like dash

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes