in Programming in C
1,260 views
0 votes
0 votes
#include<stdio.h>
void main(){
int p=-8;
int i= (p++,++p);
printf("%d\n",i);
}
in Programming in C
by
1.3k views

6 Comments

$-6\,?$
0
0
Shobhit Joshi ..May be -6 true , but I asked this question to know whether it's undefined behavior or not. Because their is two increment statement in one line. But also there is comma(,) operator.
What is your opinion?
0
0
edited by
no, there will not be any undefined behaviour.

$,$ operator is used as a operator and as $()$ are used so it gets executed first, in $left$ to $right$, and the last value is assigned to the variable
0
0

@,@...... compiler dependent,,,

0
0

@pawan kumarln in this comma operator is used as an operator, not as a separator, and it will first evaluate the left side of operator then the right side and assign the right side to the LHS. It's like using $;$

Ref : herehere

1
1
got it bro...thanks
0
0

Please log in or register to answer this question.

Related questions