Solved

c code

Posted on 2003-12-05
6
367 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
  • 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 50 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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

864 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now