390 likes | 527 Views
俺でもわかるポインタ講座. メモリ. char c; int i; float f; double d; char str[5]; int tab[2];. char *cpr; int *ipr; float *fpr; double *dpr;. struct point{ int x; int y; }; struct point pt;. char **cppr;.
E N D
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c='a'; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i=256; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]="abc"; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]="abc"; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]={1,2}; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]={1,2}; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; pt struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; pt.x =1; pt.y=2; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c='a'; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; ポインター用メモリ確保 (多くは32ビット) struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c='a'; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; cpr = &c; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c='a'; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; cpr = &c; *cpr='b'; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; ポインター用メモリ確保 (多くは32ビット) struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]=“abc”; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; ポインター用メモリ確保 (多くは32ビット) struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]=“abc”; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; cpr = str; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]=“abc”; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; cpr = &str[1]; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]=“abc”; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; +1された struct point{ int x; int y; }; struct point pt; char **cppr; cpr = &str[1]; (*cpr)++; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]=“abc”; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; 1ずれた +1された struct point{ int x; int y; }; struct point pt; char **cppr; cpr = &str[1]; cpr++; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]={1,2}; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; ポインター用メモリ確保 (多くは32ビット) struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]={1,2}; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; ipr = &tab[0]; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]={1,2}; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; ipr = &tab[1]; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point)); 注意:+4されてる
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]={1,2}; char *cpr; int *ipr; float *fpr; double *dpr; +1された struct point{ int x; int y; }; struct point pt; char **cppr; ipr = &tab[0]; (*ipr)++; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]={1,2}; char *cpr; int *ipr; float *fpr; double *dpr; +4された struct point{ int x; int y; }; struct point pt; char **cppr; ipr = &tab[0]; ipr++; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; 以下同様 struct point{ int x; int y; }; struct point pt; char **c; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c[2]="a"; char cc[2]="b"; int i; float f; double d; int tab[2]; char *cpr[2]; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c[2]="a"; char cc[2]="b"; int i; float f; double d; int tab[2]; char *cpr[2]; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; cpr[0]=c; cpr[1]=cc; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c[2]="a"; char cc[2]="b"; int i; float f; double d; int tab[2]; char *cpr[2]; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; cppr = cpr; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c[2]="a"; char cc[2]="b"; int i; float f; double d; int tab[2]; char *cpr[2]; int *ipr; float *fpr; double *dpr; +1された struct point{ int x; int y; }; struct point pt; char **cppr; **cppr++; [(*(*cppr))++] struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c[2]="a"; char cc[2]="b"; int i; float f; double d; int tab[2]; char *cpr[2]; int *ipr; float *fpr; double *dpr; +1された struct point{ int x; int y; }; struct point pt; char **cppr; *cppr++; [ (*cppr)++] struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c[2]="a"; char cc[2]="b"; int i; float f; double d; int tab[2]; char *cpr[2]; int *ipr; float *fpr; double *dpr; +2された struct point{ int x; int y; }; struct point pt; char **cppr; cppr++; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c[2]="a"; char cc[2]="b"; int i; float f; double d; int tab[2]; char *cpr[2]; int *ipr; float *fpr; double *dpr; +1された struct point{ int x; int y; }; struct point pt; char **cppr; **cppr++; [(*(*cppr))++] struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c[2]="a"; char cc[2]="b"; int i; float f; double d; int tab[2]; char *cpr[2]; int *ipr; float *fpr; double *dpr; +1された struct point{ int x; int y; }; struct point pt; char **cppr; *(*cppr++)++; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; ポインター用メモリ確保 (実際は32ビット) struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; 確保したメモリの先頭番地が代入 struct point{ int x; int y; }; struct point pt; char **cppr; 構造体用メモリ確保 struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; (*ptpr).x=1; (*ptpr).y=2; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));
俺でもわかるポインタ講座 メモリ char c; int i; float f; double d; char str[5]; int tab[2]; char *cpr; int *ipr; float *fpr; double *dpr; struct point{ int x; int y; }; struct point pt; char **cppr; ptpr->x=1; ptpr->y=2; struct point *ptpr; ptpr = (struct point*)malloc(sizeof (struct point));