Thursday, July 9, 2009

In c language int i;for(i=0;i;)printf("hai friend"); //no output for this program if u placed for(;0;) than

The question is making no sense, there is no condition set...


please reconfirm your question..!

In c language int i;for(i=0;i;)printf("hai friend"); //no output for this program if u placed for(;0;) than
In you're Ques both the 'for' loops mean the same. The only thing is you will be wasting the memory for 'i' and also wasting the execotion time of the prog in the first loop.


The nxt time if you have you're Ques, please make it clear.
Reply:correct format of for loop is as follows





for(intialiser;condition;increment/dec...





eg:





for(i=1;i%26lt;=10;i++)





you can use this loop as








i=1;


for(;i%26lt;=10;)


{





i++;





}
Reply:1) Question makes no sense


2) Frame your question properly so that at least one can give proper answers that help you


3) Provide as much data as you can of the problem


4) In case of programs try to publish programs completely.
Reply:The place where '0' is condition so u must spcify the condition following program will explain





int i;


for (i=0;i%26lt;10;i++)


printf("hai friend");





the program will display 10 times





but what u mentioned what not correct





Happy learning
Reply:second part of "for " is condition. since your condition is false / 0, it will not go inside.


for(Initialisation; loop Condition; next operation)


No comments:

Post a Comment