Token in C Language| Types of Token in C Language
Token in C Language| Types of Token in C Language
What is a Token In C language?
Token is the smallest unit in a program. It is related to each and every words and character of C program. So, compiler spilt the program in smallest possible unit, compile the every stage of program.
There are 5 types of Token:
- Keywords
- Operators
- String
- Constants
- Identifier
- Special Character.
What is a Keywords in C language?
32 Keywords of C language
S.No | Keywords | Keyword Types | Description |
---|---|---|---|
1. | int | Data types | It is related to the integer type of data. |
2. | char | Data types | It is related to the character type of data. |
3. | double | Data types | It is related to the decimal number with double-precision. |
4. | float | Data types | It is also related to the decimal number, but with single-precision. |
5. | short | Qualifiers | It is related to the fairly small integer types of data. |
6. | long | Qualifiers | It is related to the fairly large integer types of data. |
7. | signed | Qualifiers | It is related to the positive and negative integer types of data. |
8. | unsigned | Qualifiers | It is related to the only positive integer types of data. |
9. | typedef | User-defined | It is used to define a new name for an existing data types. |
10. | enum | User-defined | It gives an opportunity to user-intent data type and define which types of data can take in variables. |
11. | for | Loop | It is used when a block of code is executed fixed number of times. |
12. | do | Loop | It is used when a block of code to be executed a least once or repeatedly. |
13. | while | Loop | It is used when a block of code is to executed a variable number of times. |
14. | if | Decision | It is related to 'Boolean Expression' if statement is 'true' the block of code inside 'if' statement is executed. |
15. | else | Decision | It is also related to 'Boolean Expression' if statement is 'False' the block of code inside 'else' statement is executed. |
16. | switch | Decision | It is related to type of selection control mechanism which is used to allow the expression to change the control flow of the program execution. |
17. | case | Decision | it is part of switch and it is related to selection mechanism which is used to allow specific expression to control flow of program execution. |
18. | default | Decision | It is executed when no case expression value is match to value of expression. |
19. | continue | Jump | It is related to control the nearest enclosing loop. |
20. | break | Jump | It is related to terminate the nearest loop. |
21. | goto | Jump | It is related to jump or transfer from loop or statements to another statement. |
22. | void | Function | It is pointer declaration and indicate that the function does not return value. |
23. | return | Function | It is related to the control the calling function,. |
24. | struct | Derived | It is related to the composite data type which declare the physically grouped list of variable under one name in a block of memory. |
25. | union | Derived | It is related to User-defined data types. It collects variable of different data types in the same memory location. |
26. | auto | Storage classes | It is related to storage class and used to declare a local variable. |
27. | register | Storage classes | It indicate the compiler to use register as a memory for a variable instead of RAM. |
28. | static | Storage classes | It is related to restrains visibility of function and multiple function call. |
29. | extern | Storage classes | It is use to declare a global variable without any memory assigned to it. |
30. | const | Other | It is never change value during execution once defined. |
31. | volatile | Other | It is a qualifier that declare a variable in source code. |
32. | sizeof | Other | it is generate storage size of data types or an expression. |
Some Important Point Of Keywords in C Language:
- C language is case sensitive language, all keywords must be written in lower case.
- There are 32 keywords in C language.
- Keywords are reserved and predefined words and their meaning cannot be changed.
- Keywords cannot be used as user-intent or User-defined variable.
- Keywords are basics building block of programming syntax.
What is an Operators in C language?
In C language, Operator is a special type of symbol that tells the compiler or interpreter to perform specific mathematical and logical operations. C language is enrich in set of operators.
There are mainly 5 types of operators in C languages:
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
- Assignment Operator
Some Other operator in C Language:
- Sizeof Operator
- Comma Operator
- Conditional Operator
What is a String in C language?
What is a Constant in C language?
Types of C Constant:
- Decimal Constant
- Real or Floating point Constant
- Octal Constant
- Hexadecimal Constant
- Character Constant
- String Constant
What is a Variables in C language?
There are 5 types of variables.
- local variable
- global variable
- static variable
- automatic variable
- external variable
Important Point:
- A variable have alphabets, digits and underscore. But it starts with alphabet and underscore.
- No whitespace is allowed within variable name.
- Variable is not work as reserved words.
What is an Identifier in C language?
An identifier is a combinations of alphanumeric characters that begins with either an alphabets characters or an underscore and remaining end alphabets character, numeric and underscore which represent the various elements like: function, array, structure, labels, etc.
Some Important Point:
- At least first character of identifier is an alphabet or an underscore and followed by digits, characters and underscores. Because, it's first character does not begin with number.
- Identifier does not specified the Commas and whitespace.
- Keywords do not represent as an Identifier.
- An Identifiers are case sensitive (upper case and lower case). There are 52 alphabets characters(upper case and lower case), 10 numeric (0-9 numbers).
- The length of an Identifier can not more than 31 characters. If length of an Identifier is short and meaningful, easy to point bug or error for programmer.
Post a Comment
0 Comments
Thanks For Reading our Blog we are working to spreed knowledge around the globe .
Regards : Khan Developer