When researching double pointers, the general consensus appears to be when wanting to change the value of any variable and retain the new value when returning from a function then its pointer value needs to be passed in.
When already working with a pointer then a double pointer needs to be passed in.
The following example deals with a pointer in the main portion of the code, passes that same pointer to a function, changes its value and the new value is visible in main.
Based on what I read, a double pointer should have been required or else the new value would not be visible within main.
If this does work, then how could it be modified to show that a double pointer is required?
void func1(int *z)
{
(*z)++;
printf("z=%d\n", *z);
}
int _tmain(int argc, _TCHAR* argv[])
{
int x = 100;
int *y = &x;
printf("y=%d\n", *y);
func1(y);
printf("y=%d\n", *y);
return 0;
}