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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#include <stdio.h>
void chargerTableau( char * (*phrase[3])[3] )// char ** phrase
{
//printf("%p contient %d\n",phrase,*phrase);
(*phrase)[0][0] = "bonjour1 ";
(*phrase)[0][1] = "bonjour2 ";
(*phrase)[0][2] = "bonjour3 ";
(*phrase)[1][0] = "bonjour4 ";
(*phrase)[1][1] = "bonjour5 ";
(*phrase)[1][2] = "bonjour6 ";
(*phrase)[2][0] = "bonjour7 ";
(*phrase)[2][1] = "bonjour8 ";
(*phrase)[2][2] = "bonjour9 ";
printf("contenu : %s, [7] : %c, adresse : %d, adresse2 : %d\n"
,(*phrase)[0][0],(*phrase)[0][0][7],&(*phrase)[0][0]
,(*phrase)[0][0]);
printf("contenu : %s, [7] : %c, adresse : %d, adresse2 : %d \n"
,(*phrase)[0][1],(*phrase)[0][1][7],&(*phrase)[0][1]
,(*phrase)[0][1]);
printf("contenu : %s, [7] : %c, adresse : %d, adresse2 : %d \n\n"
,(*phrase)[0][2],(*phrase)[0][2][7],&(*phrase)[0][2]
,(*phrase)[0][2]);
printf("contenu : %s, [7] : %c, adresse : %d\n",(*phrase)[1][0]
,(*phrase)[1][0][7],&(*phrase)[1][0]);
printf("contenu : %s, [7] : %c, adresse : %d\n",(*phrase)[1][1]
,(*phrase)[1][1][7],&(*phrase)[1][1]);
printf("contenu : %s, [7] : %c, adresse : %d\n\n",(*phrase)[1][2]
,(*phrase)[1][2][7],&(*phrase)[1][2]);
printf("contenu : %s, [7] : %c, adresse : %d\n",(*phrase)[2][0]
,(*phrase)[2][0][7],&(*phrase)[2][0]);
printf("contenu : %s, [7] : %c, adresse : %d\n",(*phrase)[2][1]
,(*phrase)[2][1][7],&(*phrase)[2][1]);
printf("contenu : %s, [7] : %c, adresse : %d\n\n",(*phrase)[2][2]
,(*phrase)[2][2][7],&(*phrase)[2][2]);
}
void testTableau( char * (*phrase[3])[3] )
{
printf("\n%s %c\n",(*phrase)[1][2],(*phrase)[1][2][6]);
if( (*phrase)[1][2][6] == 'r' )
printf("%c = r",(*phrase)[1][2][6]);
}
int main()
{
char * (*phrase[3])[3] ; // = ** phrase
printf(" adresse du premier tableau de ponteur : [%d] \n\n",phrase);
printf(" 1er pointeur sur tab de pointeur : [%d] \n",(*phrase)[0]);
printf(" 2eme pointeur sur tab de pointeur : [%d] \n",(*phrase)[1]);
printf(" 3eme pointeur sur tab de pointeur : [%d] \n\n",(*phrase)[2]);
printf(" On obtient bien des adresses contigues \n separees "
"de 3 * 4 octets ( taille d une adresse )\n\n");
chargerTableau( phrase );
printf(" %d %s %c\n",&(*phrase)[0][1],(*phrase)[0][1],(*phrase)[0][1][7]);
while(1);
// testTableau(phrase);
} |
Partager