First, read the "Before you make a query" thread, specifically regarding the use of code tags around code. Poor Shabbir is not supposed to have to act like your mommy and pick up after you.

The only reason "C++ no way can do dat" is because the code is valid C, but not valid C++. You can quote that the next time that someone tells you that C is just a subset of C++.

C++ is a more heavily typed language than C. It will not presume that a function declaration with no return type declared will return an int. It will not presume that a void pointer can be implicitly cast to any other type of pointer (use of malloc also points this out).

If you merely convert your code to appropriate C++ code (see the example), the program will perform in precisely the same way. The reason that it does so is that both languages are required to provide a conversion from the address of an array to a pointer to the first byte of an array.

#include <cstdio>

void call (void * x)
    int * magic1 = (int *) x;
    int (* magic2)[] = (int (*)[]) 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);
    return 0;