You are here:

C/c programming

Advertisement


Question
sir
how we can print any line using printf but at end of printf() there is no semicolon? without semicolon(";") how can we use printf?

Answer
Hi Hiren

The C programming language demands that all its statements should end with a semi-colon (;). So ideally, we can not write a statement wherein it is not followed by the ;.

At the same time we can work around this problem with the following code:

6>5? printf("This is the truth"):getch();

The above is a conditional statement which will always be true. As a result it will always execute the printf(), which in this case does not have a semi-colon at the end.

Hope this satisfies your query.

Regards
Smitha Renny

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Smitha Renny

Expertise

I can answer questions related to basic understanding of C concepts, arrays, pointers and their handling well.

Experience

I've been programming in BASIC since 1987. Later moved onto Pascal for a short period and then hooked onto C since 1997.

Education/Credentials
I have completed a Post-Graduate diploma in Computer Applications. Currently doing MCA

©2012 About.com, a part of The New York Times Company. All rights reserved.