i have come across **pointer_name before and as i decided to have a couple hours break from the poker game im writing i thought i would experiment.
what is the difference between this
Code:
void double_it(int *p_number)
{
*p_number *= 2;
}
void add_three(int *p_num)
{
*p_num += 3;
double_it(p_num);
}
int main()
{
int x = 1;
add_three(&x);
printf("x = %d\n", x);
return 0;
}
and this
Code:
void double_it(int **p_number)
{
**p_number *= 2;
}
void add_three(int *p_num)
{
*p_num += 3;
double_it(&p_num);
}
int main()
{
int x = 1;
add_three(&x);
printf("x = %d\n", x);
return 0;
}
both give the correct answer of 8 (or at least the one i was expecting)
i don't see the purpose of writing int **number when *number will do.
coop