Operators in C language - part 2 (module 10)
In this section we will discuss on the different operators in C and there uses and functions in any C program
This is the 10th module on learning C with us. Earlier we discussed on the basic introduction and structure of C, preprocessor it's features, intermediate and executable codes. compilation and execution process of a C program. And keywords and identifiers, data types, variables and constants, scope of variables.
In this section we will discuss on our next topic and most important concepts on the different operators in C program part 2. For part 1 you may refer here :-
Assignment operators :-
They are used to assign the result of an expression to a variable. The assignment operator is '='.
|Use of simple assignment op||use of short hand op|
|a = a+1||a+=1|
|a = a-1||a-=1|
|a = a%b||a%=b|
Increment & decrement operators :-
++ and -- are called increment and decrement operators used to add or subtract. Both are unary and as follows :
++m or m++
-- m or m--
The difference between ++m and m++ is :-
1. If m =5 ; y=++m; then it is equal to m=5; m++; y=m;
means y=6, m=6
2. If m=5; y=m++ then it is equal to m=5; y=m; m++;
means y=5, m=6
Conditional operators :-
A ternary operator pair " ?: " is available in C to construct expression of the form exp1 ? exp2 : exp3 ;
It works as if exp1 is true then exp2 will execute else exp3.
In next module we will continue on the next operaters in any C language. For more information please be updated with us as we provide all the modules and cover all the topics regarding #C. Only on Www.newsandstory.com
Total 114 views