A Gem In C (remember C?)

I have no idea who wrote this, I’ve been carrying it around for at least 25 years and I truly love it. If you know the original source please let me know.

Hints: Reach char  with the ch as in cheese (a char is a character, 1 byte)

#include   "yourdreams"   /* for the future */

 * find the important things in Life, the Universe, and Everything

typedef short   some;      /* some things are short */
typedef some    very;      /* some things are very short */

#define A                  /* The first letter of the English Alphabet */
#define LINE   2           /* 2 points define a line */

#define TRUTH   BEAUTY      /* truth is beauty */
#define BEAUTY   10         /* and beauty is a 10 */

#define bad   char          /* burnt on both sides */
#define old   char          /* the great Chicago Fire */

#define   get   strlen      /* during your life, try to get some sterling */
#define youmake   float     /* you make it, I'll drink it */

#define      yourgoals   in terms you can understand

short   term;
double   yourpleasure();
double   yourfun;

long   Term, play(), agame;   /* everyone needs diversions */

old *joke = "Why did the chicken cross the road?\n\tTo get to the other side!\n\t\tWocka Wocka Wocka!\n";

bad   *joke;      /* wait- you haven't heard it yet! */
   short laugh;   /* please */

   laugh = get(joke);
   write(1, joke, laugh);   /* write it down- don't say it */


   /* most folks like music */

long play(record)
long record;
   very pleasant = TRUTH;      /* if you like music */

   while (record == pleasant)

   return( pleasant );      /* music soothes the savage */

double   yourpleasure(one, way)      /* this is necessary if */
some   one;            /* is watching ,or if you have a */
long   way;            /* to go  */
      /* this can change one while maintaining one's identity */
   one = one * one;
   return( one );      /* after all, it should have at least doubled */

hold(temper)         /* good advice */
A short temper;         /* is a dangerous thing */
   A long   time;      /* is what you need */
   very calm;      /* is how you should be */

   calm = temper, temper;

   while (calm--)

   return(calm);      /* if possible */

   /* now, on to the main thing */

main(thing, mustbe)      /* to balance work, play, and goals */
some thing, mustbe;      /* important, or we wouldn't be here */

   long   time();      /* know C */
   very   bored;      /* the result of too few goals */

   short   hours;      /* make */
   long   yourwork;   /* which makes for */
   short   tempers;   /* which can be improved by */
   long   laughing;

   /* first, set priorities */
   yourwork = 0;
   yourfun = 1.0e+38;

   if (yourpleasure( mustbe, yourwork ))
      yourfun = yourwork;
      yourfun = play( agame );

   bored = yourfun - yourwork;     /* nothing to do? */
               /* reach out and touch someone! */

   switch ( bored ) {   /* connects all of this together */
      hours = hold(LINE); /* no way to avoid it, take a */

      /* take a music break */
   while ( thing-- ) {   /* you make my heart sing */
      youmake everything;
      very groovy;

      /* focus on what is important to you */
   while ( yourfun < 0 ) {
      yourpleasure( mustbe, agame);
      yourfun = play( agame );


   exit( laughing );


The very best thing about this is that it compiles and runs. 

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen Pluralsight & LinkedIn Learning courses. He was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP and a Microsoft MVP.
This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to A Gem In C (remember C?)

  1. Pingback: Double Gem Side Set

  2. Syed Rizwan Shahzad says:

    @Corey… you did the right thing dud!

  3. Kevin Claeys says:

    This is nice, I like this part:

    while ( thing– ) {
    /* you make my heart sing */
    youmake everything;
    very groovy;

  4. Corey says:

    For yucks I was going to run this. It has been a while since I have done any C. Last time was an interview question to reverse a linked list.

    Anywho, I couldn’t get it to compile using cl.exe until I did a couple things. First I had to make a file called ‘yourdreams’ (of course) and then added a couple lines. First there was an error in the function wait, so I added on line 100:

    wait(time){return play(time);}

    Then it had an error with uninitialized local variable ‘laughing’, so I modified the tell(joke) line to be:

    laughing = tell(joke);

    Then, of course, the output is:

    Why did the chicken cross the road?
    To get to the other side!
    Wocka Wocka Wocka!

    Would the compiler of 25 years ago have compiled this one without the changes, or was I doing something wrong?

Comments are closed.