All smallest individuals unit of c is called C tokens.
There are 5 types of C tokens :
Variable : It is a Memory allocation which has a data type and specific range used to store a value which can frequently modified during the program execution. To declare a variable we need data types.
C provides three basic data type:
Integer : It is used to store numeric value with any decimal places. It has three types :
Float : Float is a variable is used to store decimal value. It has also three types :
Charter Variable : It is used to store single character. If text one byte allocation and keyword is used char.
character –> char —> 1 byte —> single character
Note: || Memory allocation for integer Variable is sometimes depends on the machine architecture. some higher configuration machine allocated two byte memory for short and four byte memory for end.
Note : || C follows the concept of signed and unsigned for integer variable. every declared variable is signed by default. although we can used a keyword signed if a variable is declared as signed , it can hold positive values as well as negative values. if we want to restrict a variable , we can declared it unsigned.
The Another advantage using unsigned int is that we will get double range in positive size.
Constant : Constant is also a memory allocation used to store a value but it can’t modify during the program execution.
There are two types if constants
- Variable Constant
- Symbolic Constant
Variable Constant : If we declare a variable as a constant using a keyword constant, it is called variables constant.
Example : int a= 50
a=a+ -> 60
Symbolic Constant : It is more powerful and flexible than variable constant. to declare symbolic constant, we used defined statement also called macro.
General format : #define constantName value
Example : #define N 100
Identifier : It is used to give the name of variable constant or any other user defined object. Identifiers may be combination of alphabets, digits and special symbol underscore(_) but it can’t begin with digits.
Example : int A
Keywords : Keyword are the reserve words of an Programming language which has certain meaning in that programming language. Although we can use any keyword in the program but we can’t re-define it.
C Provides 32Keyword of Programming:
Operators : Operators are mode or symbol to do some operation or the operand.
Cprovides 8 types of Operators:
- Arithmetic Operators
- Assignment Operators
- Relational operators
- Increment or decrement operators
- Logical Operators
- Conditional Operators
- Bitwise Operators
- Special Operators
Arithmetic Operators : It is used to perform some basic arithmetic operations like add, sub, etc.
Example : +, -, /, %, *, ++, —
Assignment Operators : It is used to assign a new value to the variable or change the existing value of variable. = is known as assignment operator.
Example : a=50
We can also combine the arithmetic operators and assignment operators to get a new operators called as arithmetic assignment operator or short hand operator.
Example : +=, -=, *=, /=, %=