home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18740 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.5 KB  |  47 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
  3. From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
  4. Subject: Re: Another C palindrome puzzle
  5. Message-ID: <9235703.672@mulga.cs.mu.OZ.AU>
  6. Sender: news@cs.mu.OZ.AU
  7. Organization: Computer Science, University of Melbourne, Australia
  8. References: <9234503.17437@mulga.cs.mu.OZ.AU> <1992Dec17.223414.164558@evolving.com>
  9. Date: Mon, 21 Dec 1992 16:39:38 GMT
  10. Lines: 35
  11.  
  12. manus@evolving.com (Manus Hand) writes:
  13.  
  14. >fjh@munta.cs.mu.OZ.AU  (Fergus James Henderson) writes:
  15. >>
  16. >>   Next challenge: Write a palindromic "hello world" program in C without
  17. >>   using comments, #if, or #ifdef.  I think it should be possible.
  18. >
  19. >Challenge accepted!
  20. [neat solutions omitted]
  21. >
  22. >Now I suppose I have to come up with the NEXT challenge.  Okaaaayyyy....
  23. >how about a palindromic "Hello world" program, with no comments, #if's,
  24. >#ifdef's, <<<OR #define's!>>>
  25.  
  26. I liked your idea of using #pragma.
  27. Here's my solution with no comments, #ifs, #ifdefs, or #defines.
  28.  
  29.     #pragma amgarp#;""\
  30.  
  31.     main(){char s[]="\
  32.     Hello World"\
  33.     ;puts(s);}
  34.     #pragma "=s*rahc"
  35.     char*s="amgarp#};)s(stup;\"dlroW olleH\"=][s rahc{ )(niam\"";
  36.     #pragma amgarp#
  37.  
  38. Next challenge: (it's starting to get real hard, folks)
  39.     No comments, #ifs, #ifdefs, #defines, and _no #pragmas_.
  40.     I'm not sure if this one is possible.
  41.  
  42. -- 
  43. Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
  44. This .signature virus is a self-referential statement that is true - but 
  45. you will only be able to consistently believe it if you copy it to your own
  46. .signature file!
  47.