for(i=1;i>0;i++);
printf("i=%d",i);
what will be the answer????

Answer Posted / vignesh1988i

since after the loop there is a semicolon , so according to
the compiler this semicolon will be taken as next line and
the loop will be iterating till the termination condition....


output possibilities :

1)if the variable 'i' which is used as an signed integer
variable , this will take an infinite values and stop at one
instance and it will terminate the application. but wont
display anything in the screen

2) if this is an unsigned variable this will be infinite
with values going on and on without stopping.. but not
displaying it...


conclusion : loop is infinite here.....



thank u

Is This Answer Correct ?    12 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In C programming, how do you insert quote characters (‘ and “) into the output screen?

900


What is dynamic dispatch in c++?

563


How can a program be made to print the line number where an error occurs?

659


What is wild pointer in c?

615


What is meant by keywords in c?

623






Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

653


What is the scope of global variable in c?

562


What does *p++ do? What does it point to?

624


What is the scope of an external variable in c?

573


What is call by value in c?

566


What are the two types of functions in c?

575


Linked lists -- can you tell me how to check whether a linked list is circular?

651


number of times a digit is present in a number

1547


What is an lvalue in c?

701


Why do we use & in c?

597