Need a quick advice on the FOR loop (im new)...
I need my loop to, basically, loop until a certain number/character is entered (let's assume it's "0" ).
My immediate thought was to do it this way:
Code:
#include <stdio.h>
int main ( )
{
int i, choice;
choice = 1;
for (i = 0; choice != 0; i++)
{
printf("Enter a number: ");
scanf("%d", &choice);
}
printf("You've entered a 0. Exiting the loop...");
}
The loop does work, but while compiling the program i get a warning that i is assigned a value that is never used. No matter what i try i just cant find a way around it, although i have this feeling its quite simple...
Please help....