Write the output of the following program: int a[ ] = {1,2,3,} *p;
Options
- 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:
inta[] = {1,2,3,} *p;
This declaration is syntactically incorrect in C.
Correct declarations could be:
inta[] = {1,2,3};
int*p;
or
inta[] = {1,2,3}, *p;
But writing
inta[] = {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.
Attempt Quiz Now:
BPSC Tre 4.0 DSA Practice Set