C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - General Questions (Q.No. 3)
3.
Which of the following special symbol allowed in a variable name?
Answer: Option
Explanation:
Variable names in C are made up of letters (upper and lower case) and digits. The underscore character ("_") is also permitted. Names must not begin with a digit.
Examples of valid (but not very descriptive) C variable names:
=> foo
=> Bar
=> BAZ
=> foo_bar
=> _foo42
=> _
=> QuUx
Discussion:
42 comments Page 2 of 5.
Keerthana said:
9 years ago
Can anyone explain me about the examples of valid C variable names?
Logapriya.S said:
9 years ago
What is the purpose of foo?
Swetha said:
9 years ago
Yes @Samuel.
AKUGIZIBWE SAMUEL said:
9 years ago
Can we use underscore only as a variable name?
Tejesh said:
9 years ago
No, @Manish, it is not the correct way to declare any variable between datatype and variable name space will be required because compiler not recognises which one is datatype and which one is a variable name.
int _aera22; this means int[space] _aera22;
This is correct declaration
int _aera22; this means int[space] _aera22;
This is correct declaration
Manish sharma said:
9 years ago
Is this decalartion int_aera22; correct?
Ashwini said:
9 years ago
Yes '$' also allowed.
Madhu said:
10 years ago
What?
Can identifiers start with '$' symbol also? I know that only the special symbol allowed is '_' (underscore). Is it correct?
Can identifiers start with '$' symbol also? I know that only the special symbol allowed is '_' (underscore). Is it correct?
Jenifer said:
10 years ago
Why shouldn't (*)? Its a pointer variable right.
Buvanesh said:
1 decade ago
Because, other symbols not allowed in variable formation as first char.
(1)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers