FIFA-2022 Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
280 views
in Tutorial & Interview questions by Goeduhub's Expert (9.3k points)

Evaluates its left operand, discards the resulting value, and then evaluates its rights operand and result yields the value of its rightmost operand.

1 Answer

0 like 0 dislike
by Goeduhub's Expert (9.3k points)
 
Best answer
Evaluates its left operand, discards the resulting value, and then evaluates its rights operand and result yields the value of its rightmost operand.

int x = 42, y = 42;

printf("%i\n", (x *= 2, y)); /* Outputs "42". */

The comma operator introduces a sequence point between its operands.

Note that the comma used in functions calls that separate arguments is NOT the comma operator, rather it's called a separator which is different from the comma operator. Hence, it doesn't have the properties of the comma operator.

The above printf() call contains both the comma operator and the separator.

printf("%i\n", (x *= 2, y)); /* Outputs "42". */

/*                      ^          ^ this is a comma operator */

/*                      this is a separator */

The comma operator is often used in the initialization section as well as in the updating section of a for loop. For example:

for(k = 1; k < 10; printf("\%d\\n", k), k += 2);   /*outputs the odd numbers below 9/*

/* outputs sum to first 9 natural numbers */

for(sumk = 1, k = 1; k < 10; k++, sumk += k)    

      printf("\%5d\%5d\\n", k, sumk);

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

0 like 0 dislike
1 answer 234 views
0 like 0 dislike
1 answer 266 views
0 like 0 dislike
1 answer 264 views
0 like 0 dislike
1 answer 267 views

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

Free Online Directory

...