#include<stdio.h> void main() { int a=1,b=2; int k; k = (a,b); printf("%d",k); }
- Comma Operator has Lowest Precedence. [Priority] i.e evaluated at last .
- Comma operator returns the value of the rightmost operand.
- Comma Operator Can acts as -
- Operator : In the Expression
- Separator : Declaring Variable , In Function Call Parameter List
In the Above Example -
1 : Comma as Seperator
It can acts as Seperator in -int a=1,b=2;
- Function calls
- Function definitions
- Variable declarations
- Enum declarations
k = (a,b);
Different Typical Ways of Comma as Operator :
int a=1,b=2,c;
Way 1 :
c = (a,b);
- c = Value Stores in b . = 2
c = a,b;
- c = Value Stores in a . = 1
0 Comments:
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email