Unary Operators in C Language


OPERATORS GROUPS 

(ACCORDING TO THEIR PRIORITY ORDERS)







UNARY OPERATORS






Increment and Decrement operators


Increment ++ and Decrement -- to change the value of an operand (constant or variable) by 1.

Increment ++ increases the value by 1 whereas Decrement -- decreases the value by 1. Both operators are unary operators, which means they only operate on a single operand.


++ INCREMENT OPERATOR 






-- DECREMENT OPERATOR 




Note :-   Post and Pre Increment/decrement Operator has same function but
                      Post Increment/decrement  operator has lowest priority among
                       above all operator and Pre Increment/decrement 
                          operator has top priority  among all operator.


Size of operator


Size of is an unary operator which returns the size of data( constant, variables, array, structure etc).

Example :





Output


x=2

y=8

z=2



Note :-  In above output, value of y=8 because by default any value written                   in point (3.56) consider as double type until you mentioned                            it's type as float as we seen in above example and value of z=2                       because of ASCII Code, every character constant internally 
         consider as integer. 

Comments

Popular posts from this blog

Important Announcements(download all my book free)

O LEVEL- INTERNET TECHNOLOGY & WEB DESIGN

Call by Reference with Pointer in C Language part-4-a