C Puzzles

yet another place for C puzzles

Thursday, July 14, 2005

 

Misc Puzzles

Write a program whose printed output is an exact copy of the source.Needless to say, merely echoing the actual source file is not allowed.


char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}


----------------------------------

Write a "Hello World" program in 'C' without using a semicolon.


int main(){if (printf("Hello World" )){}}


----------------------------------
Find the purpose of the following function.


int s_( char * _){ return _?*_? (1 + s_(_+1)):0:0;}



Ans: String length !!!!

Comments:
ok
i too are interested in c
if u get any puzzles
sent to my blog as comment
 
sir,

no need of nesting of condition. oper
is needed
int s_(char *_)
{
return *_?(1+s_(_+1)):0;
}
 
Post a Comment

Subscribe to Post Comments [Atom]





<< Home

Archives

July 2005   August 2005   October 2005   December 2005   March 2006   June 2006   July 2006   December 2006   February 2007   June 2007   March 2010   May 2010  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]