To tylko jedna z 2 stron tej notatki. Zaloguj się aby zobaczyć ten dokument.
Zobacz
całą notatkę
Pointers vs. multi- dimensional arrays • For these definitions: int a[10][20]; and int *b[10]; • Expressions a[3][4] and b[3][4] refer to a single int . • But: - a is a true two-dimensional array with 200 integers - the location of a[row,col] in memory: initial_address + 20 * row + col - b is only an array of 10 pointers - the memory for rows of b should be allocated • Compare the declaration and picture for an array of pointers: char *dnam[] = {"error", "one", "two", "three"}; • with those for a two-dimensional array: char enam[][6] = { "error", "one", "two", "three" };
... zobacz całą notatkę
Komentarze użytkowników (0)