Solved

c code

Posted on 2003-12-05
6
366 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

708 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

17 Experts available now in Live!

Get 1:1 Help Now