0 0 votes What is the output of following program? int i ; main ( ) { int j; for (; ;) { if (j = function (i)) printf (“j = %d \n”, j) else break; } } function (x) { int x ; static int v = 2; v - - ; return (v – x); } j = 1 j = - 1 j = 2 Programming in C programming-in-c output programming + – Parshu gate 1.3k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
1 1 vote is j=1 is the answer??? saipriyab answered Nov 27, 2017 saipriyab comment Share Follow See all 6 Comments 6 6 Comments reply Show 3 previous comments saipriyab commented Nov 27, 2017 reply Follow flag No condition is defined so condition is always true it will run infinitely for(;;) means no initialization,no condition,no increment Actually for the first time after printing j it will go for increment no increment is defined so check condition since no condition is defined it is always true and then call function print j and this continues ... 0 0 replyShare Parshu gate commented Nov 27, 2017 reply Follow flag when will it terminate? 0 0 replyShare saipriyab commented Nov 27, 2017 reply Follow flag First time j=function(0) 1 will be printed second time j=function(0) It will come out of the for loop as if(0) means condition is false 1 1 replyShare Please log in or register to add a comment.