Tokens in C:
A Token is nothing a keyword, identifier, a constant, a string literal, or a symbol. C program have five these tokens.
- Every line in c program ends with semicolon; it is the terminator of the statement. (Compiler understands statement ends here)
printf(“Hai C”);
return 0;
2. Keywords: C has 32 key words every key word has a meaning in c library so these are not used as variable or constants.
See the below list of keywords.
Auto | else | long | switch |
Break | enum | register | typedef |
Case | extern | return | union |
Char | float | short | unsigned |
Const | for | signed | void |
continue | goto | sizeof | volatile |
default | if | static | while |
Do | int | struct | double |
These keywords called as reserve words.
3. Identifiers: C has identifiers, an identifier starts with a letter alphabets A to Z, a to z, or and an underscore ‘_’ followed by zero or more letters, underscores, and digits (0 to 9). C identifiers are used to identify variable or function.
C is case sensitive and it does not allow special characters like @,$,% . for example cpp and CPP is not same.
4.Comments : Comments are used for helping text in the program. The comment is given in /* and */ these two symbols. The compiler will ignore the when it recognizes the symbols.
/* my first program in C */
5.White spaces in c: White space is a blank space i.e whitespace is the term used to display the blank space, new line, empty characters etc. c recognizes the blankspaces. 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.