程序代码:
#include <stdio.h> #include <stdlib.h> typedef int A[2][3]; A *p = (A*)malloc(sizeof(A)); int main() { (*p)[1][2] = 6; printf("%d\n", (*p)[1][2]); return 0; }
人生是一场错过 愿你别蹉跎
#include <stdio.h> #include <malloc.h> int main() { int *p, i, j; p = (int *)malloc(100); for(i = 0; i < 2; i++) for(j = 0; j < 2; j++) { *(p + 2 * i + j) = i; printf("%d\n", *(p + 2 * i + j)); } free(p); return 0; }