Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef union
- {
- int tableau_int_8x8[8][8]; // type 1
- char tableau_char_5x5[5][5]; // type 2
- int tableau_3D[3][4][5]; // type 3
- // etc.
- } Tableau
- void ecrire_tableau(Tableau *tableau, char type)
- {
- switch(type)
- {
- case 1 : tableau->tableau_int_8x8[y][x] = 10;
- break;
- case 2 : tableau->tableau_char_5x5[y][x] = 3;
- break;
- case 3 : tableau->tableau_3D[z][y][x] = 14;
- break;
- }
- }
- int main()
- {
- Tableau tableau_char;
- Tableau tableau_int;
- Tableau tableau_3D;
- ecrire_tableau(&tableau_char, 2);
- ecrire_tableau(&tableau_3D, 3);
- ecrire_tableau(&tableau_int, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement