Ejemplo punteros

#include<stdio.h>

int main(int argc, char ** argv) {
  printf("argc %d\n", argc);
  printf("argv %s\n", argv[1]);

  int a=0;
  int* pa;
  pa=&a;

  int b1[]={10,43,45};
  int b2[]={20,53,55};
  int b3[]={30,63,65};
  int i;
  int *pb[3];
  pb[0]=b1;
  pb[1]=b2;
  pb[2]=b3;
  int ** ppb;
  ppb=(&pb)[0];
 
  for(i=0; i<3; i++) {
    printf("ppb=%p **ppb=%i\n", ppb, *(*(ppb+i)+1));
  }

  printf("pa=%p\n", pa);

  for(i=0; i<3; ++i) {
    b1[i]=i;
    printf("b1[%d]=%d\n", i, b1[i]);
  }

  //printf("a=%d, pa=%p, a=%d\n", a, pa, *pa);
  return(0);
}
  • teaching/ejemplo_punteros.txt
  • Last modified: 2016/02/26 12:11
  • by amora