A question posed for a following post…
What the difference between these two programs? Not just the obvious line change, but the real difference as a result of that line change.
int main(int argc, char *argv[])
{
char input = 'c';
if (input == 'c')
{
puts("Always");
}
else
{
puts("Never");
}
return 0;
}
int main(int argc, char *argv[])
{
char input = getchar();
if (input == 'c')
{
puts("Always");
}
else
{
puts("Never");
}
return 0;
}
Think compilers… and I’ll have the answer to you soon.