Generally when we use printf("") statement, we have to use a semicolon at the end. If printf is used inside an if Condition, semicolon can be avoided.
Yes, You can see the example.
Yes, You can see the example.
Source Code
#include<stdio.h> int main(){ //printf returns the length of string being printed if (printf("Hello World\n")) //prints Hello World and returns 11 { //do nothing } return 0; }
Output
Explanation:
The if statement checks for condition whether the return value of printf("He llo World") is greater than 0. printf function returns the length of the string printed. Hence the statement if (printf("H ello World")) prints the string "Hello World".
You may also like:
* C++ Program To Implements Snake and Ladder Game ( Graphics )
0 comments:
Post a Comment