How do i terminate a loop.

i have written

for(int i = 0; students; i++)

but it keeps on going forever and will not stop.

Look up the definition of a for loop. What do each of the parts of the loop do? Do your parts comply?

Assuming that students is an integer value then setting your for() loop like this should fix your problem:

for(int i = 0; i < students; i++)

Assuming that students is an integer value then setting your for() loop like this should fix your problem:

for(int i = 0; i < students; i++)

i tired but i get this error msg
ISO C++ forbids comparison between pointer and integer \
?????

What is students? Can you show me the declaration for it?

What is students? Can you show me the declaration for it?

studentData studentss[100];
int numberOfStudents = 0;

is that wat u mean by declaration ??

for(int i = 0; students[i]; i++)
for(int i = 0; students[i]; i++)

now the error is
could not convert `students' to `bool'

Look up the definition of a for loop. What do each of the parts of the loop do? Do your parts comply?

I have, i done this before i posted this question! it says that the boolean expression is used to test condition to determine when the loop should terminate. The test condition must always involve comparing the value of the counter variable with some numerical limit. Which in this case was

but im unsure still.
should i use a true false statement ??

for(int i=0; i<noofstudents; i++)

i think this will help you out assuming noofstudents contains the value for the no of times you want to run the loop...or i.e no of students of type studentdata...

thankx

I have, i done this before i posted this question! it says that the boolean expression is used to test condition to determine when the loop should terminate. The test condition must always involve comparing the value of the counter variable with some numerical limit. Which in this case was

but im unsure still.
should i use a true false statement ??

In the for statement you posted for(int i = 0; students[i]; i++) , what is your comparison statement? What is it comparing?