The Gateway to Computer Science Excellence
0 votes
192 views
Choose the statement that are syntactically incorrect in C language?

1.for( ; ; );

2./* this is a /* a valid */ comment*/

3.return 5;

4.return(6+3);
in Programming by Junior (875 points) | 192 views
0
2 is wrong. You can break it like this.
 /* this is a /*
a valid
*/ comment*/
0
You just copy please explain how is it wrong .
0
/* this is a /*   ==> This is comment.
a valid         ==> This will give error. Because it is not a comment.
*/ comment*/  ==> This is also comment.

for( ; ; ); This is correct. This is infinite loop. Conditional part is always true.

For option 3 and 4, They are very obvious. They are  correct.

2 Answers

0 votes
a function can return only one value at a time,
by Boss (12.3k points)
edited by
+1
But in line 4 it is not returning two values. It is adding 6 and 3 and then returning their sum.
0 votes
Only 2 is incorrect. As we know a comment in C starts with /* and ends with */. There is no concept of nested comment in C . Once we put */ , the comment ends there. Rest of the line is considered as redundant and hence is synctactically incorrect in C
by Loyal (7.4k points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,321 answers
198,395 comments
105,145 users