Bonjour,

Je voudrais realiser un pointeur sur un tableau 2d pour le passer comme argument à une fonction.

Voici un exemple de ce que je veut faire.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <stdlib.h>
 
/*prototype de la fonction*/
void initialisation(int **);
 
int main(int argc, char *argv[])
{
 
  int tab[10][10];
  int **point;    /*mon pointeur sur le tableau 2d*/
 
  point=&tab[0][0];
 
  initilisation(**point);
 
  system("PAUSE");	
  return 0;
}
 
/*ma fonction qui recoit le pointeur en argument*/
 
void initialisation(int **p_point)
{
     int i,j,b;
     for(i=0;i<10;i++)
     {
           for(j=0;j<10;j++)
           {           
                       p_point[i][j]=0;
                       b=p_point[i][j];
                       printf("%d",b);      
           }
           printf("\n");
     }
 
}