Becoming a polymath: Harvard CS50 Week 1

This week marked my jump from visual programming in Scratch to writing actual lines of code in C. To be honest, it felt like being thrown into the deep end. Scratch was all drag and drop, intuitive, and forgiving. C, on the other hand, made me think about everything: every semicolon, every parenthesis, every memory decision. But strangely, I loved it.

My First Experience with C

The first program I wrote was the classic:

#include <stdio.h>

int main(void)
{
    printf("Hello, world!\n");
}

Typing it out, compiling it, and seeing those words appear in the terminal gave me a weird sense of power. I had written something real. But as soon as I moved on to more complex programs, things got tricky fast.

Key Concepts I Learned

This week introduced a bunch of core programming fundamentals:

  • Data types like intchar, and float,
  • Variables and how to declare them properly,
  • Conditionals (ifelseelse if),
  • Loops like forwhile, and do-while,
  • And most importantly—functions and how to break code into reusable parts.

It felt like I was learning a new language, one keystroke at a time.

Where I Struggled

Debugging in C was a challenge. Forget a semicolon? The compiler throws a fit. Miss a closing bracket? Nothing works. I spent 30 minutes once trying to find out why a loop didn’t run—turned out I initialized the variable wrong.

Handling user input also took time to get right. For example, using scanf() is straightforward, but one mistake (like using the wrong format specifier) can cause weird behavior:

codeint age;
printf("Enter your age: ");
scanf("%d", &age);

I also got my first taste of memory management—like how every variable is stored in RAM and how you have to be cautious with how you access or modify data. It’s a lot to think about, and I can see why people say C teaches you how computers really work.

A Slightly More Complex Example

Here’s a snippet from a small program I wrote to check if a number is even or odd:

code#include <stdio.h>

int main(void)
{
    int number;
    printf("Enter a number: ");
    scanf("%d", &number);

    if (number % 2 == 0)
    {
        printf("It's even!\n");
    }
    else
    {
        printf("It's odd!\n");
    }
}

Simple, but writing it from scratch made me feel like I had leveled up from Scratch—no pun intended.

What I Took Away

C is unforgiving, but it teaches discipline. Every bug made me slow down and understand what the computer was actually doing. This week taught me that coding is less about typing and more about thinking. And honestly, seeing code compile and run correctly after hours of debugging is one of the most satisfying feelings I’ve had in a long time.