Type casting in C language:upper casting,down casting,explicit down casting,example,implicit upper casting.
Operator in C- language :arithmetic operator,relational operator assignment operator,logical operator,conditional operator,increment operator,decrement , bitwise ,member access ,member referencing operator,operator precedence or hierarchy of operator
Type casting in C language
Conversion of one data into another datatype is known as type casting .There are 2 types of type casting.
1 Upper Casting :
Conversion of smaller data type into larger datatype is known as upper casting.
2 Down -Casting:
Conversion of larger datatype into smaller datatype is known as Down Casting.
A Explicit down casting :
This type of casting is performed by programmer manually.
Example : int a =5.6; -> 5
B Implicit upper casting :
This type of casting is performed by c language automatically.
int a=5.6; --> 5 ( explicit down casting)
float x=7; --> 7.000 (Implicit upper casting)
Operator in C- language:
Operators are used to perform some operations in c language different types of operations are available in c language is as follows:-
1 Arithmetic operators -> ➕,➖,✖, ∕,%
2 Relational operators -> >,<,>=,<=,==(equal to),!=(not equal to)
3 Assignment operators(=) :
It use to copy value on its right hand side to the variable on its left hand side .
int a =10; a =10
4 logical operators:
&& (logical AND) ampersand ,||(logical OR ),!(logical NOT)
5 Conditional operator -> ?:
6 Increment operator -> ++
7 Decrement operator -> --
8 Bitwise operator -> &( Bitwise AND),|( Bitwise OR),^(Bitwise XOR),>>(Bitwise right sift),<<(Bit wise left shift).
9 Member access operator -> .(dot)
10 Member referencing operator : ->
Operator precedence or hierarchy of operator
1. * ,/,% 2. +,-, 3 =
float a = 9* 6/2 + 3*5 + 9/3
= 9*3+15+3
= 27+18
float a = 45.000

Comments
Post a Comment