Discuss Forum
1. Consider the following variable declarations and definations in C . (i) int var _ 9 =1 ; (ii) int 9 _ var =2; (iii) int + =3; Choose the correct statement w.r.t above variables.
- A. Both i. and ii. are valid
- B. Both i. and ii. are valid
- C. Both i. and ii. are valid
- D. Both i. and ii. are valid
Answer: Option C
Explanation:
In C language, a variable name can consist of letters, digits and underscore i.e. _ . But a variable name has to start with either letter or underscore. It can't start with a digit. So valid variables are var_9 and _ from the above question. Even two back to back underscore i.e. __ is also a valid variable name. Even _9 is a valid variable. But 9var and 9_ are invalid variables in C.
Post your comments here: