Hi , I code in C++ . Now when a peice of C came to me, i didnt know C could do that also. To recreate my point i have a simple peice of code \

Code:
call(void * x){
int * magic1 = x;
int (* magic2)[] = x;
printf(" data is %x \n", (*magic2)[1]);
printf(" data is %x \n", *magic1);
}
int main(){
int z[3] = {1,2,3} ;
call(&z);
call(z);
}


Output is :
data is 2
data is 1
data is 2
data is 1


. Now my basic question is :
when i do this ----------- call(&z)
I send the address of the pointer to the array(i.e z)
But when i do this----------call(z)
I send the pointer to the array.
Now void sinks both of them
And with both calls to function call it gives the same result i.e no difference between pointer to an array and the address of the pointer to an array and also

no difference between int * and int * [3]
Why is that so ?????


In C++ no way you can do that.

Last edited by shabbir; 21Jun2007 at 18:57.. Reason: Code block