Types Of Conbols And Definition

1151 Words5 Pages

These are also known as literals and are defined as the fixed values. This means they cannot be altered. They may be floating type, integer type, character type etc. It may also be defined as Variables, but there values cannot be changed.
The string literals are written in the double quotes. These characters may be plain characters or may be escape characters also.

Defining Constants

 The #define Preprocessor
It is one of the way to define constants as...
#define value of identifier

Example illustrating as....
#define VARIABLE ONE 20
#define VARIABLE TWO 60
#define NEWLINE '\n' int main() { int ADD; ADD = VARIABLE ONE + VARIABLE TWO; printf("value of ADD : %d", ADD); printf("%c", NEWLINE);
…show more content…
Just as in case of mathematics we can make calculations, similarly here also we can do same. It may also be noted that it is one of the simplest task that the C programming performs. There are following types of operators as...

 Arithmetic Operators
It performs the simple mathematical addition, subtraction, division, modulus, multiplication, incremental and decrement operators. Example illustrating it as....

#include int main()
int a = 11; int b = 110; int c ; c = a + b; printf("addition is %d\n", c ); c = a - b; printf("subt. is %d\n", c ); c = a * b; printf("multip. c is %d\n", c ); c = b / a; printf("div. is %d\n", c ); c = a % b; printf("modulus is %d\n", c ); c = a++; printf("inc. is %d\n", c ); c = a--; printf("decr. is %d\n", c );


sum is 121 sub. is -99 multip. is 1210 div. is 10. modulus is 0 inc. is 12 dec. is 10

 Relational Operators
This simply relates the operators as which includes greater than, less than, not equal to, greater than or equal to, less than or equal to as....

#include int main()
int a = 21; int b = 10; int c ; if( a == b ) { printf("a is equal to b\n" ); } else { printf("a is not equal to b\n" ); } if ( a < b ) { printf("a is less than b\n" ); } else { printf("a is not less than b\n" ); } if ( a > b ) { printf("a is greater than b\n" ); } else { printf("a is not greater than b\n" ); }

    More about Types Of Conbols And Definition

      Get Access