1 votes 1 votes Suppose in my c program having infinite loop and it is printing garbase values ... Because of some logical errors... So till what time it will run and why ??? Will it give error if yes than why?? papesh asked Aug 11, 2016 papesh 411 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes initialy int i= 16; while(i>0) { i++; print("%d", i); } you are done logical error i++ instead of i--. since int has some limit to store aftr when limit exhaust then some vaue wil be trancated and u get garbage. Prashant. answered Aug 11, 2016 Prashant. comment Share Follow See all 2 Comments See all 2 2 Comments reply papesh commented Aug 11, 2016 reply Follow Share while(true) { print("Hello"); } What about this?? 0 votes 0 votes Prashant. commented Aug 11, 2016 reply Follow Share garbage is not given here . hello is printed. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes since it is infinite loop and assuming there is no break in it then it will run for indefinite time there should be no error as it is not a syntx error and it is perfectly valid to have an infinite loop Sanjay Sharma answered Aug 11, 2016 Sanjay Sharma comment Share Follow See all 2 Comments See all 2 2 Comments reply papesh commented Aug 11, 2016 reply Follow Share What about garbase values?? 0 votes 0 votes Sanjay Sharma commented Aug 11, 2016 reply Follow Share garbage values may be coming from inside the loop due to may reasons 0 votes 0 votes Please log in or register to add a comment.