logical operation & pre-increment in c -


can 1 explain why c still equal 15 after execution

int main(void) {     int t,a=5,b=10,c=15;         t= ++a||++c;         printf("%d  %d  %d",t,a,c); } 

the logical-or operator || short-circuit operator. if left side evaluates true boolean value (i.e. not 0), right side doesn't execute.

similarly logical-and operator &&, if left hand side false (i.e. 0) right hand side not execute.


Comments