A C Program without a semicolon to print the length of a string

Here is a small code without a semicolon:#include <stdio.h>
void main()
if(printf(“nString length: %dn”,printf(“Welcome to the world of programming”)))
}printf()returns the number of characters it successfully prints on the screen. Hence the innerprintf()function inifstatement returns a value 35 in this case and outerprintf()function prints String length: 35. Since outerprintf()function returns a non-zero value , theifstatement results in TRUE and the program executes nothing as the block is intentionally left blank.Note: The concept of stack is used here wherein the secondprintf()function is the first to be executed (LIFO) .OUTPUT:Welcome to the world of programmingString length: 35

News Reporter

Leave a Reply

Your email address will not be published. Required fields are marked *