1 votes 1 votes closed with the note: It has sequence point problem. #include<stdio.h> void main(){ int i=11; printf("%d \n", i++|++i); printf("%d",i); } Output is: 15 13 I understand how 13 came but I don't get how 15 came. And why there is no sequence point problem in this? Programming in C programming-in-c + – Akhilesh Singla asked Mar 18, 2018 • closed Mar 18, 2018 by Akhilesh Singla Akhilesh Singla 553 views comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes bro take this line printf("%d \n", i++|++i); this is nothing but 11 = 1011 12 = 1100 11 || 12 = (1011 | 1100) = BitwiseOR(1011,1100) = (1111)2 = (15)10 Salazar answered Mar 18, 2018 Salazar comment Share Follow See all 7 Comments See all 7 7 Comments reply Show 4 previous comments Akhilesh Singla commented Mar 18, 2018 reply Follow Share Because we are only evaluating one expression in printf. For example, printf("%d %d",++i|i++,++i); this would be a sequence point problem because it involves two expressions to be evaluated on a single variable without using valid sequence point(s). Am I wrong or right?! 0 votes 0 votes Salazar commented Mar 18, 2018 reply Follow Share i think it's fair to say the output is compiler implementation dependent, do you agree @srestha ? 0 votes 0 votes Devshree Dubey commented Mar 18, 2018 reply Follow Share @Akhilesh Singla,please go to my comment section in the original question and check please. I hope it helps u. 0 votes 0 votes Please log in or register to add a comment.