First evaluate a=1,2,3,4; In this statement total 2 types of operator are there(= and ,). Precedence of (=) operator is higher than (,). Hence, first a=1 gets evaluated by compiler and 1 is assigned to a. Now, a=1 statement return 1 Therefore, statement become 1,2,3,4. (,) operator return the right side operand as answer but there is no variable to store this value.
In second statement b=(1,2,3,4) First (1,2,3,4) evaluted due to brackets and return 4 which gets stored in b.
In i=0,2,4 arithmatic expression (=) has higher priority compared to (,) So, i=0 gets evaluted first and 0 is stored in i. After that remaining expression becomes 0,2,4 (i=0 return 0 to original expression) 0,2,4 evaluted using (,) operator as Ex. x,y return y. So 0,2,4 evaluted as 4. Hence, final condition part of if can be written as if(4). Any non-zero value is considered as true in C. Hence, condition of if statement is true and as a result Comment Yes0 will be printed by program.
In this program first (printf("practicepaper"),3) gets evaluted by compiler as x,y return y. NOTE: (,) operator evaluted by compiler with x,y first execute x then y and finally retun y. Therefore, first printf function print "practicepaper" and then (printf("practicepaper"),3) return 3 which will be stored in a.
NOTE: (,) operator evaluted by compiler with x,y first execute x then y and finally retun y.
In first expression k=(++i,++j); i become 1, then j become 2 and finaly (++i,++j) return 2 which is stored in k. So k become 2. Output of first printf is 122
In second expression k=(i++,j++); i remain 1, then j remain 2 and finaly (i++,j++) return 2 which is stored in k. So k become 2. After that due to post increment on i and j, value of i become 2 and value of j become 3. Output of second printf is 232
thanks i got 2/7 now i know my level i got motivated to study harder.
It’s good practice