L
lovecreatesbeauty
#define N 100
#define LEN 1024
char a1[N][LEN];
char *m2 = malloc(N * LEN);
char *c3 = calloc(N, LEN);
char *p1 = (char*) &a1[1][0];
char *p2 = m2[1 * LEN + 0];
char *p3 = c3[1 * LEN + 0];
suppose allocate memory successfully, do p1, p2, p3 all point to the
1024th character, the beginning of the second row in array terms?
thank you for your time.
#define LEN 1024
char a1[N][LEN];
char *m2 = malloc(N * LEN);
char *c3 = calloc(N, LEN);
char *p1 = (char*) &a1[1][0];
char *p2 = m2[1 * LEN + 0];
char *p3 = c3[1 * LEN + 0];
suppose allocate memory successfully, do p1, p2, p3 all point to the
1024th character, the beginning of the second row in array terms?
thank you for your time.