我忘记将随附的变量添加到 printf() 调用中。printf() 如何知道我想打印什么?
int successful = 0;//Flag
printf("\nEnter a number to search for: ");
scanf("%d", &data);
successful = search(list, data);
successful? printf("\n'%d' was found\n\n", data) : printf("\n'%d' was NOT found\n\n");
有问题的代码是最后一行三元表达式的最后一个“else”。我已经运行了几十次,它似乎总是在输出中打印正确的参数。
: printf("\n'%d' was NOT found\n\n");
每次这仍然如何工作?