Curso de Programación en C/Prog75
Ir a la navegación
Ir a la búsqueda
Prog75
1 #include <stdio.h>
2
3 int main( void )
4 {
5 int zippo[4][2] = { {2,4}, {6,8}, {1,3}, {5, 7} };
6 int (*pz)[2];
7 pz = zippo;
8
9 printf(" pz = %p, pz + 1 = %p\n",
10 pz, pz + 1);
11 printf("pz[0] = %p, pz[0] + 1 = %p\n",
12 pz[0], pz[0] + 1);
13 printf(" *pz = %p, *pz + 1 = %p\n",
14 *pz, *pz + 1);
15 printf("pz[0][0] = %d\n", pz[0][0]);
16 printf(" *pz[0] = %d\n", *pz[0]);
17 printf(" **pz = %d\n", **pz);
18 printf(" pz[2][1] = %d\n", pz[2][1]);
19 printf("*(*(pz+2) + 1) = %d\n", *(*(pz+2) + 1));
20
21 return 0;
22 }
Resultado
[rrc@Pridd CClase]$ gcc -Wall -o Prog75 Prog75.c [rrc@Pridd CClase]$ ./Prog75 pz = 0xbfd6ca6c, pz + 1 = 0xbfd6ca74 pz[0] = 0xbfd6ca6c, pz[0] + 1 = 0xbfd6ca70 *pz = 0xbfd6ca6c, *pz + 1 = 0xbfd6ca70 pz[0][0] = 2 *pz[0] = 2 **pz = 2 pz[2][1] = 3 *(*(pz+2) + 1) = 3