This topic is now archived and is closed to further replies.


Pointer Arrays

Recommended Posts

Pointer arrays work just as normal arrays...

int main(void)
//An array of pointers-to-ints
int *p_array[10];
//4 ints
int a, b, c, d;

//Init the pointers with the addresses of some vars
p_array[0] = &a;
p_array[1] = &b;
p_array[2] = &c;
p_array[3] = &d;

//Change the value of a to 666
*p_array[0] = 666;

//Change the value of b to 555
*p_array[1] = 555;

//Change the value of c to 444
*p_array[2] = 444;

//Change the value of d to 333
*p_array[3] = 333;

return 0;

/. Muzzafarath

Edited by - Muzzafarath on 4/2/00 6:39:12 AM

Share this post

Link to post
Share on other sites