Pointer Arrays
Call me a newbie, but I don''t know how they work? I need to know this for my new GUI. Can you tell me please
Pointer arrays work just as normal arrays...
/. Muzzafarath
Edited by - Muzzafarath on 4/2/00 6:39:12 AM
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
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement