How I failed epically in my very first line of code

Recently, I stumbled upon these interesting videos on the YouTube channel of Bloomberg, where iconic people in computer science tell the story of their first lines of code. For instance, Mary Lou Jepsen tells how she replaced the Pong ball with a smiley face or how Linus Torvalds stuck his computer in an infinite loop. It is nice to hear that people were ninjas in coding even during their first time, but this was not the case with me. In this post, I am going to share how I failed epically in my very first line of code.

There are two things to know about me to understand this story.
1. I was a mathematics major with zero programming experience.
2. I am Hungarian, and the domain extension for Hungary is .hu.

So, in my sophomore year, the Introduction to Programming class was mandatory for math majors. We were taught C during the course. In the lab, the first assignment was of course to write the Hello World! program. The instructor nicely explained the printf() function and how we need to include the stdio.h header, which contains printf(). Thus without any hesitation, I produced the following code:

#include <stdio.hu>

int main(){
printf(“Hello World!”);
}

The code didn’t compile with the error

fatal error: stdio.hu: No such file or directory

and I had no idea what was wrong. After reading the code through for 10 times and still having no idea, I asked the instructor to help me. She was also puzzled, because the stdio.h file was clearly in the folder /usr/include, where it was supposed to be. After 5-10 minutes of frantically looking for the problem, we realized that it was in the very first line:

#include <stdio.hu>

which was supposed to be

#include <stdio.h>

This was the first time I felt that an instructor wanted to hit me. But it was okay, since I also wanted to bang my head against the wall. Anyway, this is how I learned not to code from muscle memory. (But I do it anyway.)

Author: Tivadar Danka

Applied Pure Mathematician

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s