When I was asked during my studies at Holberton to explain recursion in a blog post, I was told that images are worth 1500 words. This statement is often true but I find recursion to be one of the cases where it actually doesn’t really apply. Indeed There are a lot of really cool images about recursion but they all have one common flaw. They almost always portray infinite recursion, like the one above. Therefore I much prefer the saying:
“In order to understand recursion, you must understand recursion”
It says it all. It is recursive (repeats itself indefinitely), but…
For this tutorial I am going to assume that you are already familiar with Object Oriented Programming (OOP) and know what an object is, what a class is and how to instantiate an object. But in a nutshell an object is a unique instance of a given class, it has a unique ID and is of a given type. Let’s dig a little deeper into these notions…
So lets assume we have the following code:
3 class MobilePhone:
4 def __init__(self, make, model, color):
5 self.make = make
6 self.model = model
7 self.color …
So in Object Oriented Programming (OOP) a class is a programming construct that allows you to create data structures (object) that have two things, a state and a behavior. By state we mean that the object can store some data that is specific to itself. By behavior we mean that the object has access to a common set of functionalities (called methods and not functions, because they are defined on an object). The canonical example is to compare classes to factories and objects to what comes outside of the factories. In this analogy if we have a
Car class then…
What are the differences?
So before getting into the differences let’s start with the global definition as both dynamic and static libraries serve the same purpose. A library is a predefined set of functions and variables that can be utilized when writing an application. At its core that’s all a library is. No need to reinvent the wheel each time you write some code. Use the wheel that someone has already built for you! And by the way that’s what you do when you include
stdio.h at the top of
.c file in order to use
printf. There is no…
Like anything else stored in a computer’s memory, numbers are stored as 0 and 1. This is the infamous binary code, like in the matrix you are either a one or a zero…
So for example on a 64 bit machine a signed integer (that is an integer that can be positive or negative) is stored over 32 bits, a combination of 32 zeros and ones with the most left bit reserved for the sign. 0 for positive numbers and 1 for negative numbers.
This is the actual representation of the positive number 1:
For simplicity sake let’s work…
A library is just a file packaging some common functionality. In other words it is just a piece of code, i.e functions and variables, that you’ve grouped together because you thought it a good idea to reuse it for more then one application. Just like a book in a normal library. you need to learn something about a precise subject you go to pick a book about this topic. Note that libraries are not executable files and therefore cannot do much on their own. …
In a nutshell, compilation is the act of taking some code in a certain language and turning it into code in an another language. In the case of C, we are transforming human readable code (also called high level) and turning it into machine code (also know as binary code) that the computer can interpret.
To compile a program you use a compiler such as
gcc on your human readable C file like so:
>$ gcc main.c -o main
gcc compiler will parse the
main.c file and turn it into an executable (a file you can run directly from…
Files exist at a precise location in memory. Let’s say a piece of software on your computer needs to access a certain file. In order to do this it will first need to find a reference to that file. That’s where links come in handy.
You find 2 sorts of links, Hard and Symbolic (some times called Soft). They serve the same purpose, i.e referencing a file, but they do it in a different manner. Note, that Hard links are more ancient than Symbolic links and are seldom used in modern Unix machines.
Hard links have 2 main limitations:
So your new to the Terminal and you don't know about
man ls yet or you are scared of the output on the screen when you run it. I hear you, it can be daunting at first… But you still want to know what
ls means? Right? Fear not, you’ve come to the right place.
So you are in your terminal. You've ran
pwd which prints the directory in which you are currently sitting otherwise know as the current working directory and you want to know what files and other directories you can access in this directory. Well that’s when…