Solved

c code

Posted on 2003-12-05
6
368 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

786 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