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

Logapriya.S said:   9 years ago
What is the purpose of foo?

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

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

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.

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.

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.

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)

Vamshi said:   7 years ago
Give one example for the pointer.
(1)

Rajat said:   7 years ago
What is meant by variable? Please explain.
(1)

Silanbu said:   7 years ago
@Rajat.

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


Post your comments here:

Your comments will be displayed after verification.