I was just trying to use a void pointer to an integer array ,I tried to see if i can print the array back by casting it back into int. But it is giving me some random value.
You need to cast arr before adding j. Here is a minimal fix:
arr
j
x = *(((int *)arr)+j);
but I think it's clearer to write:
x = ((int *)arr)[j];