呼び出し元から渡されたポインター値を表示する関数を作成しています。元の **arr1 を台無しにしたくないので、それに **P を割り当ててから、印刷して数えます。しかし、その後 arr1 である左側がゼロになります。
コード:
void merge(int **arr1, int **arr2, int **arr3)
{
int **p1= arr1;
int **p2= arr2;
int **p3= arr3;
int count;
printf("%d\n", **arr1); //this shows the correct value of first element of arr1
while(**p1)
{
printf("%d\n", **p1);
(*p1)++;
count++;
}
while(**p2)
{
printf("%d\n", **p2);
(*p2)++;
count++;
}
printf("%d\n", **arr1); // this become zero, why??i didn't touch it in my code didn't i?
}