Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

c code

Posted on 2003-12-05
6
Medium Priority
?
373 Views
Last Modified: 2010-04-15
Is that i can printf something on console using code which should'nt have semicolon,

May be its stupid question,Pls give hints


chiku
0
Comment
Question by:chikucoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9881911
I remember seeing this one

hint : if ( ... ) does not need semicolon inside and printf returns something ... Damn. I cant recollect the answer ... will try to punch out a few things
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 200 total points
ID: 9881961
finally got it

#include <stdio.h>

int main()
{
         switch ( printf ("abc") > 0  )
         {
         }

               
}
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9882215
sunnycoder-

Don't actually need the "> 0" since printf returns an integral value.
Cool trivia.

-bcl
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 45

Expert Comment

by:sunnycoder
ID: 9882231
yeah realized that .... was just fumbling with variations of if () when idea of switch struck ... posted in hurry
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9882275
Be a fun interview question: In standard C (or standard C++) write the "Hello, World!" program without using a semicolon.

Or: Your computer's semicolon key is non-operative and you've been asked to demonstrate writing the ubiquitous "Helllo, World!" program in C/C++ for the CEO's young daughter. Do what you can to keep your job; no pressure.

-bcl
0
 
LVL 1

Author Comment

by:chikucoder
ID: 9882536
Sunny

Suggest me some good kindergarten c school
I guess i have to start from scartch

yeah blc it was interview qts
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question