C Programming - Control Instructions - Discussion

Discussion Forum : Control Instructions - Point Out Correct Statements (Q.No. 9)
9.
Point out the correct statements are correct about the program below?
#include<stdio.h>
int main()
{
    char ch;
    while(x=0;x<=255;x++)
        printf("ASCII value of %d character %c\n", x, x);
    return 0;
}
The code generates an infinite loop
The code prints all ASCII values and its characters
Error: x undeclared identifier
Error: while statement missing
Answer: Option
Explanation:

There are 2 errors in this program.
1. "Undefined symbol x" error. Here x is not defined in the program.
2. Here while() statement syntax error.

Discussion:
12 comments Page 2 of 2.

Jay said:   10 years ago
How to know which error will come first?

Mage said:   9 years ago
Simply explain in a program.


Post your comments here:

Your comments will be displayed after verification.