The String Joke

by Michael McDonnell on 2004-09-10
Other Formats:

Table of Contents

The String Joke
Background

The String Joke

Two strings walk into a bar.

The first string says to the bartender, “Give me a beer.” The bartender turns to the second string and says, “and what about for you?” To which the second string replies, “I would also like a beer#@a9101gb230b81;kajf3#$B89*#()*13!$%#@$"” and goes on and on spewing gibberish.

The bartender, shocked, asks the first string, “What is your buddy's problem?

The first string answers, “Oh, you'll have to excuse him, he isn't null terminated.

Background

I first heard this joke when I was an undergraduate. I was told that you could go to any social gathering and immediately know who was a programmer and who was not by telling this joke. The joke makes absolutely no sense to people who haven't programmed in C or similar languages. At the same time, even a first year computing student would understand the joke since problems with null terminated strings plague novice programmers.

Go ahead and try it at the next party you attend. Most of the room stare at you mute and stupefied but that one programmer in the room will identify him or her self by laughing aloud.

Note

If your interested in the behavior behind humor, I suggest you look at thelaughlab study. They examined thousands of jokes across many cultures. The study concluded by creating what they believe as the funniest universal joke.