Adventures in C

If you’re more familiar with Python and you want to learn C you’ll need to tackle pointers…

Let’s look at an example :

The first thing you may notice is that there is no need for a “return” from the function….

Example 1 – Pointers


void tripler(int *p);

int main(){
    int num = 5;
    int *ptr;
    ptr = &num;


void tripler(int *p){
    *p = *p * 3;

pointer and address of operator

Example 2 – Pointer that updates conditionally, based on values read from an array

Example 3 – How to convert seconds into h:m:s

Convert seconds into h:m:s with C

Example 4 – Hundreds, tens, units from a 3 digit integer.

Use the modulus operator and division by 10

2d Arrays in C

Numpy is easier? Same concept though…

Previous article

Python API – POST Requests

Next article

Google Cloud Platform