Just Programming
Pages
Home
C C++ Topics
JAVA Aptitude
Assaan IT Solutions
My Facebook Group
My Site
Thursday, 18 April 2013
Misplaced break statement error
What will be output if you will compile and execute the following c code?
void
main(){
int
a=2;
if
(a==2){
a=~a+2<<1;
printf(
"%d"
,a);
}
else
{
break
;
}
}
(A)
It will print nothing.
(B)
-3
(C)
-2
(D)
1
(E)
Compiler error
Explanation
:
Keyword break is not part of if-else statement. Hence it will show compiler error: Misplaced break
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment