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 2 of 5.

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?

Maan said:   7 years ago
We declare a pointer in this way;

int *ptr;.

Here pointer is also a variable than answer should be *.
(1)

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

But they cannot start with the Digits like 0123456789.

Silanbu said:   7 years ago
@Rajat.

The variables are the memory boxes that are data given to the computer to process it.
(2)

Nanthakumar said:   9 years ago
C is case sensitive right? Then how to use (QuUx) in the variable name? Anyone explain!

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

Sureshkumar said:   1 decade ago
Where to use underscore operator? can you give me the merits and demerits?

Subhalaxmi said:   1 decade ago
I can not understand the question clearly? can you give full explanation?

Buvanesh said:   1 decade ago
Because, other symbols not allowed in variable formation as first char.
(1)

Animesh said:   1 decade ago
We can't use special symbol in a variable name excluding underscore(_)


Post your comments here:

Your comments will be displayed after verification.