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?
* (asterisk)
| (pipeline)
- (hyphen)
_ (underscore)
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 3 of 5.

A.yamini said:   5 years ago
Why we use only underscore ?why not other symbols for variable name?
(3)

Keerthana said:   9 years ago
Can anyone explain me about the examples of valid C variable names?

Monisha said:   6 years ago
Then what is the purpose of *(asterisk) , | (pipeline), - (hyphen)?
(1)

Kittu said:   1 decade ago
@sudi, s area_2 is correct, because digits can be used in variable.

Supriya said:   1 decade ago
What are the other symbols mentioned in the options used for?

Sunil said:   1 decade ago
As only underscore is predefined to used as variable name.

Thiru said:   2 decades ago
Names must not begin with a digit.??Is this is right?

Ravi said:   1 decade ago
It is necessary to declare variable in this format.

Balaji said:   1 decade ago
What is variable name why we use? what is keyword?

Jenifer said:   10 years ago
Why shouldn't (*)? Its a pointer variable right.


Post your comments here:

Your comments will be displayed after verification.