Month 1, Low-Level Programming
Managing memory allocation on the heap, using recursion to solve technical problems, the second month of the ALX program was a blast!
Welcome to Month 1! The curriculum for this month was majorly on understanding the C programming language better, using C code to practise software engineering concepts, and building out our first non-primitive data structure (which was a list).
TL;DR: Practised more problems and concepts using C. Understood the compilation process of a C source code better, especially the role of a preprocessor. Learnt more about the memory layout in C and how to manage memory on the heap. Built and performed basic operations (traversing, insertion, searching, e.t.c) on a singly-linked list.
Overview for the month
Building on our knowledge for C from Month 0, this month was majorly on practising a lot of concepts and tasks using the C programming language.
Learnt how to get details from the shell on running a C program using the argc
and the argv
arguments in the main
function of a C source code. Understood the processes involved in taking a C file from source code to executable file, and what each part of the process does. Started working with dynamic memory allocation on the heap using malloc
and learnt how to check and handle memory leaks by using the Valgrind tool and the free
library function.
Built a custom version of the printf
library function, played around with using variadic functions in a C program, learnt on how structures (struct
) and type definitions (typedef
) worked in C. Then the last week of the month was on learning about non-primitive data structures, scenarios where different data structures would work best, and on how to build and use a singly-linked list.
Key Concepts Learnt
Memory Layout and Management in C
Learning about the stack, the heap, and other parts of the memory layout in a C program.
Knowing which part of memory is dynamic and which part is static. Practising with allocating dynamic memory on the heap using
malloc
.Understanding the dangers of memory leaks in an executable program, and learning how to check our programs for leaks.
Compilation Process of a C file
Went through all processes involved in the compilation of a C file from source code to executable file.
Learnt on what the preprocessor does, its importance in making header files work in C and the benefits of include-guarding header files.
Data Structures (Introduction)
Got introduced to other types of data structures built on the primitive ones.
Learnt on the importance of choosing the right data structure for a task, and on how to determine the best data structure to use based on the scenario of the task.
Studied the difference between an array and a list. Got to know the key differences between the structures, and on when to use either of them.
A lot of the code I wrote while practising on these topics are in this GitHub repository, from 0x08 to 0x13.
Summary
Month 1 was majorly on practising with C, and using the language to practise some key software engineering concepts. Next month's curriculum is the dreaded "Simple Shell", and I am trying to start practising for that as early as I can. Hopefully I'll be able to pass through the dreaded gates of shell by this time next month(lol).
Thanks for reading through my trials and tribulations as a SE studentπ« , that's a wrap on Month 1ππ.