Advertisement
Guest User

Remplir tableau (Planète Casio)

a guest
Aug 18th, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. typedef union
  2. {
  3.     int tableau_int_8x8[8][8]; // type 1
  4.     char tableau_char_5x5[5][5]; // type 2
  5.     int tableau_3D[3][4][5]; // type 3
  6.     // etc.
  7. } Tableau
  8.  
  9. void ecrire_tableau(Tableau *tableau, char type)
  10. {
  11.     switch(type)
  12.     {
  13.         case 1 : tableau->tableau_int_8x8[y][x] = 10;
  14.             break;
  15.         case 2 : tableau->tableau_char_5x5[y][x] = 3;
  16.             break;
  17.         case 3 : tableau->tableau_3D[z][y][x] = 14;
  18.             break;
  19.     }
  20. }
  21.  
  22. int main()
  23. {
  24.     Tableau tableau_char;
  25.     Tableau tableau_int;
  26.     Tableau tableau_3D;
  27.  
  28.     ecrire_tableau(&tableau_char, 2);
  29.     ecrire_tableau(&tableau_3D, 3);
  30.     ecrire_tableau(&tableau_int, 1);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement