Page 105 - 6437
P. 105
i++;
}
return 0;
}
When the above code is compiled and executed, it produces the following result:
Address of var[0] = bfdbcb20
Value of var[0] = 10
Address of var[1] = bfdbcb24
Value of var[1] = 100
Address of var[2] = bfdbcb28
Value of var[2] = 200
Array of Pointers
Before we understand the concept of arrays of pointers, let us consider the following
example, which uses an array of 3 integers:
#include <stdio.h>
const int MAX = 3;
int main ()
{
int var[] = {10, 100, 200};
int i;
for (i = 0; i < MAX; i++)
{
printf("Value of var[%d] = %d\n", i, var[i] );
}
return 0;
}
When the above code is compiled and executed, it produces the following result:
Value of var[0] = 10
10
8