C Identifiers
On this page (6sections)
Definition:
Identifiers are sequences of characters used for naming variables, functions, new data types, and preprocessor macros.
Rules:
- Identifier can be include letters uppercase(A-Z) and lowercase(a-z)
- Identifier can be decimal digits(0-9).
- The first character of an identifier cannot be a digit.
- You Can Include the underscore character _ in identifiers.The first character of an identifier cannot be an underscore(Some Compilers Accept underscore as a first Character).
- Lowercase letters and uppercase letters are distinct, such that foo and FOO are two different identifiers.
- When using GNU extensions, you can also include the dollar sign character $ in identifiers.
Syntax
data_type name_of_identifeir // Variable name
data_type name_of_function(......)// function name
Identifiers Example
// Variable
int amount;
char name[20];
// Function
void calculation(int a,int b){
}
Related Pages
Continue learning with these related tutorials and programs:
- C Tutorials — Browse all C Tutorials.
- C Introduction — Start here — what C is and why it matters.
- C History — More in c basics.
- C Specific Properties and Implementation — More in c basics.
Frequently Asked Questions
What does this C program do?
It is a C example program that demonstrates C Identifiers, including the complete source code and the expected sample output.
How do I compile and run this C program?
Save the code in a `.c` file, compile it with `gcc filename.c -o program`, then run it with `./program` (or `program.exe` on Windows).
What concepts does this example use?
This example uses arrays, illustrating a common pattern in C programming.