Write the output of the following program: int a[ ] = {1,2,3,} *p;
Asked In: BPSC TRE 3.0Options
- A. Junk value
- B. 3
- C. Runtime error
- D. More than one of the above
- E. None of the above
E. None of the above
Explanations:
The given code snippet is:
int a[] = {1,2,3,} *p;
This declaration is syntactically incorrect in C.
Correct declarations could be:
int a[] = {1,2,3};
int *p;
or
int a[] = {1,2,3}, *p;
But writing
int a[] = {1,2,3,} *p;
is invalid syntax, so the program will not compile.
Since the program does not compile, there is no output and it is not a runtime error.