diff --git a/c_pointers/chapter_4.c b/c_pointers/chapter_4.c index 1dae1af..55bab0c 100644 --- a/c_pointers/chapter_4.c +++ b/c_pointers/chapter_4.c @@ -72,18 +72,26 @@ int main(void) { displayArrayPtr(vector, sizeof(vector)/sizeof(int)); - // using one-dimensional array of pointers + // using a one-dimensional array of pointers { int *arr[5]; for (size_t i = 0; i < 5; i++) { // both variants are equivalent - arr[i] = (int*) malloc(sizeof(int)); + arr[i] = malloc(sizeof(int)); *arr[i] = i; //*(arr + i) = (int*) malloc(sizeof(int)); //**(arr + i) = i; } } + // pointers and multidimensional arrays + { + int matrix[2][5] = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}}; + for (size_t i=0; i<2; i++) { + + } + } + return 0; } \ No newline at end of file