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


#define VAL 888
#define TAB_SIZE 5
#define TAB_INIT {0, 1, 2, 3, 4}


int g_a = 1, g_b = 2;
int g_tab[TAB_SIZE] = TAB_INIT;


/*******************************************************************************
But de l'exercice:
Determiner l'affichage du programme ci-dessous.
*******************************************************************************/


/*******************************************************************************
Fonctions auxilliaires
*******************************************************************************/


int 
f_1(int a, int b)
{
  return a + b;
}
 

int 
f_2(int a, int b)
{
  return a = b = VAL;
}


int 
f_3(int a, int b)
{
  int g_a = VAL;
  return g_b = VAL;
}


int 
f_4(int x)
{
  return x = VAL;
}


void
g_1(int a[], int b[])
{
  a[1] = b[1] = VAL;
}


/*******************************************************************************
Fonction Principale
*******************************************************************************/


int 
main(void)
{
  int a = 3, b = 4, c = 5;
  int x, i;
  int tab[TAB_SIZE] = TAB_INIT;
  
  x = f_1(b, c);
  printf("\n\n%d \n%d \n%d \n%d", x, a, b, c);

  x = f_2(a, b); 
  printf("\n\n%d \n%d \n%d", x, a, b);

  x = f_3(a, b); 
  printf("\n\n%d \n%d \n%d", x, g_a, g_b);

  x = f_4(g_a); 
  printf("\n\n%d \n%d \n%d", x, g_a, g_b);
  
  for (i = 0, printf("\n\n") ; i < TAB_SIZE; i++) 
    {printf("%d ", tab[i]);}

  g_1(tab, g_tab); 
  printf("\n\n%d \n%d", tab[1], g_tab[1]);


  return EXIT_SUCCESS;
}






