C tokens, Identifiers and Keywords are the basics in a C program.
Keywords are predefined, reserved words used in programming that convey a special meaning to the c compiler. Keywords are part of the syntax and You cannot use it as a variable name, constant name etc.
The list of 32 C keywords is given below:
auto | break | case | char | const | continue | default | do |
double | else | enum | extern | float | for | goto | if |
int | long | register | return | short | signed | sizeof | static |
struct | switch | typedef | union | unsigned | void | volatile | while |
Along with these keywords, C supports other numerous keywords depending upon the compiler.
Identifiers are the names you can give to entities such as variables, functions, structures etc. These are user defined names consisting of arbitrarily long sequence of letters and digits with either a letter or the underscore(_) as a first character.
Identifier names must be unique. They are created to give unique name to a C entity to identify it during the execution of a program. C does not allow punctuation characters such as @, $, and % within identifiers. C is a case-sensitive programming language. Thus, "Happy" and "happy" two different identifiers in C.
There are certain rules that should be followed while naming c identifiers:
Some examples of c identifiers:
Name | Remark |
---|---|
_A9 | Valid |
Temp.var | Invalid as it contains special character other than the underscore |
void | Invalid as it is a keyword |
Whitespace is the term used in C to describe blanks, tabs, newline characters and comments. Whitespace separates one part of a statement from another and enables the compiler to identify where one element in a statement, such as int, ends and the next element begins.
there must be at least one whitespace character (space) between int and money for the compiler to be able to distinguish them. But, in the following statement −
no whitespace characters are necessary between "a" and "=", or between "=" and "b", although you are free to include some if you wish to increase readability.
Hope you like this tutorial, Please share your thoughts by comment section below.
Please Share with your friends.
No any Comment yet!