0 votes 0 votes closed with the note: undefined Behaviour in C #include<stdio.h> int main() { int i = 5; int a = ++i + ++i + ++i + ++i; printf("%d",a); return 0; } How is the output 31? and not 30? Shouldn’t it be 6+7+8+9? Programming in C programming-in-c + – shaz asked Dec 13, 2018 • closed Dec 13, 2018 by Shaik Masthan shaz 377 views comment Share Follow See all 3 Comments See all 3 3 Comments reply Shaik Masthan commented Dec 13, 2018 reply Follow Share never ask such type of questions in GATE.... don't waste your time on this 0 votes 0 votes shaz commented Dec 13, 2018 reply Follow Share how would I know if question is eligible to asked in GATE. I posted because I couldn't understand the logic. :/ 1 votes 1 votes Shaik Masthan commented Dec 13, 2018 reply Follow Share read https://gateoverflow.in/62411/undefined-behaviour-in-c 2 votes 2 votes Please log in or register to add a comment.