Comma, Increment and Decrement Operators

Hello guys, I hope that you are enjoying my blog posts. If you liked my posts then don’t forget to share this site to your friends and do give a review.

Now, we will discuss about the Comma Operator :

  • Comma operator some time treated as a Separator also.

We will take one example to understand how it will work :

main()

{

int i = 10, j =20 , k =30;       //Here comma ( , ) operator treated as a separator of i , j and k                                                      variables

k = i , j;              //Here comma ( , ) act as a operator

printf(” %d %d %d”, i , j , k);

}

 

Now we will discuss about Increment and Decrement Operator:

  • This operator is a unary operator. It needs only one operand to perform a task.
  • There are two types of the category are there :
  1. Pre – Increment/Decrement ( i.e.  ++a, –a)
  2. Post – Increment/Decrement ( i.e. a++ , a–)
  • It will modify the operand value. So constant is not allowed ( i.e. 10 ++ is expression is totally wrong).

Pre increment:

Untitled Diagram (12).jpg

 

Post Increment :

Untitled Diagram (13).jpg

  • Same you must do and it will be decrement operator.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: