Consider the following C statements: char *str1 = "Hello; /* Statement S1 */…
GATE · 2026 · CS · Set 1 · Computer Science & IT
Consider the following C statements:
char *str1 = "Hello; /* Statement S1 */
char *str2 = "Hello;"; /* Statement S2 */
int *str3 = "Hello"; /* Statement S3 */
Which of the following options is/are correct?
- A.
S1 and S2 have syntactic errors
- B.
S2 has a lexical error and S3 has a syntactic error
- C.
S1 has a lexical error and S3 has a semantic error
- D.
S1 has a syntactic error and S3 has a semantic error
Attempted by 193 students.
Sign up free to check your answer
Sign up freeLoading lesson…