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 1 of 5.
A.yamini said:
5 years ago
Why we use only underscore ?why not other symbols for variable name?
(3)
Monisha said:
6 years ago
Then what is the purpose of *(asterisk) , | (pipeline), - (hyphen)?
(1)
Silanbu said:
7 years ago
@Rajat.
The variables are the memory boxes that are data given to the computer to process it.
The variables are the memory boxes that are data given to the computer to process it.
(2)
Rajat said:
7 years ago
What is meant by variable? Please explain.
(1)
Vamshi said:
7 years ago
Give one example for the pointer.
(1)
Maan said:
7 years ago
We declare a pointer in this way;
int *ptr;.
Here pointer is also a variable than answer should be *.
int *ptr;.
Here pointer is also a variable than answer should be *.
(1)
Keerthana said:
8 years ago
@ALL.
1) variable names can contain;
a)A-Z
b)a-z
c)0-9
d)underscore character
2) First character must be letter or underscore.
3) The special characters are not allowed like #,$ etc.
1) variable names can contain;
a)A-Z
b)a-z
c)0-9
d)underscore character
2) First character must be letter or underscore.
3) The special characters are not allowed like #,$ etc.
Saisree said:
8 years ago
The C rule of declaring variable name says that variable name starts with the underscore but not with other special characters, but $ can also be used right. Then why it is not mentioned in c rules.
Vidya said:
9 years ago
The C rule of declaring variable name says that variable name starts with the underscore but not with other special characters, and it should not be any identifier name.
Nanthakumar said:
9 years ago
C is case sensitive right? Then how to use (QuUx) in the variable name? Anyone explain!
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers