Understanding the stack data structure

Stack is an ADT (Abstract Data Structure) which follows the LIFO (Last In First Out) order. It might be easier to understand this concept by imagining an actual stack of books. When working with stacks, you can use mainly two operations. push() to add an element to the top of a stack and pop() to literally pop out or remove an element of a stack. As it is considered an ADT (Abstract Data Structure) you can implement it in many ways with other basic data structures such as arrays or linked lists.
Read more →

Understanding signals in Linux

What is a process ID? A process ID a.k.a. PID is literally what the name says, it is a number to uniquely identify a running process. You can print your program’s PID in C using the getpid() function included on the header file unistd.h. int main(void) { while (1) { printf("PID: %d\n", getpid()); sleep(1); } } output: “ PID: 12345 ” note: “12345” is a PID for an arbitrary process.
Read more →

Introduction to pointers in C

When we declare a variable in C, we generally do something like this: int num = 1; As you might know, variables get stored in memory, and the size of each variable will differ depending on its data type. For instance, an integer variable like num declared above is 4 bytes long on my Mac, but the size could vary depending on the machine. You can always check the size of a particular data type by using the sizeof() operator.
Read more →