how can we use a printf statement without a semicolon???
this was a question asked during an interview of a computer engineering student.
Shillz
-5
Newbie Poster
Recommended Answers
Jump to PostMay be a printf within a printf would do the trick.Because the inner printf doesn't require the semicolon.
Jump to PostHere the statement finishes with a comma, not a semicolon:
#include <iostream> int main() { printf("Hello"), getchar(); return 0; }
Jump to Posthow can we use a printf statement without a semicolon???
this was a question asked during an interview of a computer engineering student.Assuming this was a job interview, I suggest you stay away from any job that asks foolish questions like this. I would not want to work for …
Jump to Posthow can we use a printf statement without a semicolon???
this was a question asked during an interview of a computer engineering student.You can always put the call to printf in an if-statement, like this:
#include <stdio.h> int main(void) { if( printf("Hello World!\n") ) {} return …
All 13 Replies
csurfer
422
Posting Pro
William Hemsworth
1,339
Posting Virtuoso
Shillz
-5
Newbie Poster
William Hemsworth
1,339
Posting Virtuoso
vandna
0
Newbie Poster
nomemory
9
Light Poster
nomemory
9
Light Poster
William Hemsworth
1,339
Posting Virtuoso
csurfer
422
Posting Pro
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
yellowSnow
commented:
First sensible response to this thread. Exactly what I wanted to say. ;-)
+2
kvprajapati
commented:
Very good suggestion.
+6
MrNoob
24
Posting Whiz in Training
mvmalderen
2,072
Postaholic
William Hemsworth
commented:
Good thinking.
+5
xavier666
commented:
the best of the lot
+1
Shillz
-5
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.