I want to use a variable that i receive from the user to further frame a condition in a loop.
do
{
int sp= get_int("Enter the start size of llama population:");
}
while (sp>=9);
how shall i fix this error? i am new to C
I wanted the sp variable to receive an input greater or equal to 9, and if not, i wanted to prompt the user again to enter a valid number with the help of a do-while loop. however, this resulted in an undeclared variable error.
spis out of scope after the closing brace of the{...}block it is declared in. You need to declare it in the same scope as thewhilestatement: