[email protected] wrote: > > what does this line of code do? > why does it have 2 '*'? > is this a kind of pointer or something?? > > int** variable; > > Thanks
int variable; // variable is an integer. int *variable; // variable is a pointer to an integer. int **variable; // variable is a pointer to another pointer that points at an integer int i; // I is an integer. int *pi; // PI is a Pointer to an Integer. int **ppi; // PPI is a Pointer to another Pointer that points at an Integer pi = &i; // PI now points at I ppi = π // PPI now points at PI (which in turn points at I) i = 5; // Sets I to 5. *pi = 10; // Sets I to 10 (because PI points at I) **ppi = 15; //Sets I to 15 (because PPI points at PI which points at I)
