如果我添加 OR 条件语句,此循环不会终止。如果一个是假的,那么它应该终止。
//全局变量
int x = 100;
char *n= malloc (64);
void add(void)
{
do
{
printf("Would you like to add 1? (y/n) ");
fgets(n, 64, stdin);
//removes newline
n[strlen(n)-1] = '\0';
x++;
}
//if I add || (x!=100) it keeps looping me even if I press "n"
//otherwise without it it works fine
while((strncmp(n, "n", 1) != 0) || x!=100 );
free(n);
}