Let's say there is a variable that is letters[MAX], and I want to scan for each array index like letters[1], letters[2], etc. How is this done?
I tried doing a for loop something like
for (i = 0; i < MAX; i++)
{
printf ("Letter: ");
scanf ("%d", &letters[i]);
}
but this does not work properly. I mean it works, but it'll keep scanning until I reach whatever the MAX is (which is 100 in my program) and I tried putting it in a do while loop while (letters != 0) but it is outside of the for loop and doesn't end the loop when I enter 0.
So what I'm trying to do is assign a value to each array variable (letters[i]) by scanf'ing user input and ending the loop when 0 is entered, but the code I've tried does not work.