#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

int global=1024;
int global2;

void g(int *pi) {
  printf(">>>> Adresse %p Valeur %d\n",pi,*pi);
  *pi = 2345;
}

void f(int param) {
  int local;
  printf("Variable locale %p\n",&local);
  g(&local);
  printf("Variable locale %p\n",&param);
  g(&param);
}

int main(int argc,char *argv[]) {
  void (*pf)(int);

  pf = f;
  printf("Pointeur sur fonction %p\n",pf);
  //  g((int *)pf);
  
  printf("Variable globale %p\n",&global);
  g(&global);
  printf("Variable globale %p\n",&global2);
  g(&global2);
  
  int *p = malloc(sizeof(int));
  int *p2 = malloc(sizeof(int));

  printf("Allocation dynamique %p\n",p);
  g(p);
  printf("Allocation dynamique %p\n",p2);
  g(p2);
  
  f(3);

  free(p);
  free(p2);

  p = (int *)0xFFFFFFFFFFFFFF00;
  *p = 8888;
    
  exit(0);
}