I'm trying to build a guessing game.
Hi, I'm trying to build a guessing game in C. But when I pass true
in while loop in throws the following error:
error: 'true' undeclared (first use in this function); did you mean 'free'?
How can I solve this?
#include<stdio.h>
#include<stdlib.h>
int main()
{
srand(time(0));
int hidden = rand()%100 +1;
printf("%d\n", hidden);
while (true){
int guess;
scanf("%d", &guess);
if(guess == hidden){
printf("You are right");
break;
}
else if(guess > hidden){
printf("Guess smaller");
}
else{
printf("Guess Larger");
}
}
return 0;
}