while (ch = getchar() != EOF) putchar(ch);
Can you help the programmer fix the bug by rewriting the code? Explain briefly.
The following code segment written by a beginner in C does not work as expected. However, there is no compilation error. Can you spot the bug and rewrite the piece of code so it is bug-free? Explain briefly why the bug arose.
int
x = 5;
if (x = 0) printf("Zero\n");else
printf("Non-zero\n
");
The user-defined function used by the program takes a float number as an argument and returns nothing.
The program uses two function declarations, and no definitions.