2 votes 2 votes Plz. explain the difference between these two codes,Running it on different compiler i find some output but i don't know the reson 1. main() { int i; for(i=0,i<54,i++) int j ; } 2. main() { int i; for(i=0,i<54,i++) { int j ; } } Amit Prakash Tiwari asked Dec 22, 2016 • edited Dec 22, 2016 by srestha Amit Prakash Tiwari 378 views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply srestha commented Dec 22, 2016 reply Follow Share No difference between them 0 votes 0 votes air1 commented Dec 22, 2016 reply Follow Share None of these 2 codes on GCC 4.8.1 The second one will compile if you add two semicolons after i++ but the first one wont even after this addition. I think the reason is similar to the condition here http://stackoverflow.com/questions/22419790/c-error-expected-expression-before-int Very nice question. +1 0 votes 0 votes srestha commented Dec 22, 2016 reply Follow Share Both will produce compile time error because of for loop.rt? 1 votes 1 votes air1 commented Dec 22, 2016 reply Follow Share yes both will produce a compile time error due to the for loop. but if you correct that error, code 1 will still not compile. 0 votes 0 votes Dilip Puri commented Dec 22, 2016 reply Follow Share Actually both will not produce compile time error only first one will. I've tested with gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3). 0 votes 0 votes Please log in or register to add a comment.