#include <stdio.h>

void swap(int* a, int* b)
{
	int temp = *a;

	*a = *b;
	*b = *a;
}

int main()
{
	int x = 10, y = 5;
	swap(&x, &y);

	return 0;
}

/* The example above shows the avarage use of a pointer function. That I can understand.
But I remember when I was in my first semester in university, I had to pass pointer-to-pointer
to functions dealing with trees or graphs if I want to modify them without returning the pointer.

Why?

The explanation that I have always got is that x and y variables are restricted to the main function.
swap can't acess them directly, so we need to pass their adresses. But with data structures or with that
allegro5 case, I was already sending (or so I tought) the pointers to init_all(), so why can't the main
function retrieve them? Why do we need to use pointer-to-pointer in some cases? */