Difference between for loop and while loop?



Difference between for loop and while loop?..

Answer / dev yadav

in for loop we should know initial &last condition.....but in while loop we only know the last condition....
ex. of for loop..for(i=0;i<=10;i++){
printf("%d",i);
}
ex. of while loop..while(i<=10){
printf("%d",i);
i++;
}

Is This Answer Correct ?    10 Yes 4 No

Post New Answer

More C Interview Questions

How do you initialize pointer variables?

1 Answers  


explain what is a newline escape sequence?

1 Answers  


Is an array parameter is always "by reference" ?

1 Answers  


write a c program to find largest number in matrix(in each row,each column, diagonally, and in the whole matrix)? Its urgent.

2 Answers  


How many main () function we can have in a project?

1 Answers  


wats SIZE_T meant for?

1 Answers  


15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?

1 Answers  


What is a buffer in c?

1 Answers  


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

1 Answers   TCS,


What is nested structure?

1 Answers  


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

1 Answers  


What are 'near' and 'far' pointers?

1 Answers  


Categories