Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

in C++ what's mean that statment do and is it legal code :

OpenStudy (anonymous):

if(16) cout <<"ok"<<endl; cout<<"yeah"<<endl;

OpenStudy (anonymous):

First off it is legal code. Secondly, anything non-zero in c is True so "if(16)" evaluates to true and thus processes "cout<<"ok"<<endl;" which just says to send the text "ok" followed by an "end line" to the standard out (cout), normally the console. Since there are no brackets here, this ends the if statement and the next line gets processed regardless of whether the if evaluated to True or not. If you ran this it would output "ok" on one line and "yeah" on the next line. If you changed 16 to 0 it would only output "yeah".

OpenStudy (anonymous):

@msmithhnova thx

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!