Week 4 - Memory


Hi guys, how are you?

I know that is al lot of time that I didn't wrote but let's move on, I'm back!

I'm here to talk to you about the 4th week of CS50, which has been one of the most difficult to understand. Until now, we had only been using variables without knowing where they were stored in memory. However, this week I discovered an incredible world of possibilities, and as you know: "with great power comes great responsibility."

So, how do we handle memory in C? With pointers: variables that store specific memory addresses. It may seem simple, and in some ways, it is, but after working only with "values," it feels a bit cryptic, and it’s not as straightforward as it might seem.



After introducing pointers, the professor explained how to allocate memory using the malloc function. He also discussed scope in more depth, and toward the end, we encountered files. Everyone knows what a file is, but using them in a C program was quite challenging. At first, I struggled with it, and only after watching that part of the lecture three times did I start to feel more comfortable with it. The problem sets for this week were very challenging but also a lot of fun. The first one was called Filter, where we had to write some functions for a program that could apply different filters to a photo—amazing! In the second problem, we had to recover a camera's memory card—such a fun problem! I had to think a lot and make several attempts before arriving at the solution, but I succeeded, and as you can imagine, the feeling was wonderful.

So, my journey continues, and I’m really enjoying the process—it’s amazing!

Commenti

Post più popolari