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.

Chandrabhan B. said:   1 decade ago
Why underscore allowed in variable formation as first character in variable?

Sonam said:   1 decade ago
How compiler will know that int*p; is a pointer variable? Because in other way round variable name is not allowed to began with "*".

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

Umakant said:   1 decade ago
Means variable name max 32 characters only.

Manju said:   1 decade ago
Is int *a also possible in pointers.

Drashti said:   1 decade ago
@Sachin.

it means that variable name can contain only 32 characters not more than it system depend means it is dependent on system that how many character system will allow.

Ex. Assume that one system allow 32 char. Other allow 28.
So i hope YOu understand.

Anandrao said:   1 decade ago
The identifiers can start with the $ and _.

But they cannot start with the Digits like 0123456789.

Ragaveni said:   1 decade ago
To @Sudi as per me,

We cannot use any other symbol except (_) and always variable name starts with a letter or (_) after any one of this we can use digits.

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

Sachin said:   1 decade ago
Variable name can be 32 character. (this is system dependent).

What is exact meaning of variable name is 32 character?

What is meaning of system dependent?


Post your comments here:

Your comments will be displayed after verification.