Even after casting a void pointer, I am getting compilation error while dereferencing it. Could anyone please let me know the reason of this.
int lVNum = 2;
It doesn't make sense to dereference a void pointer. How will the compiler interpret the memory that the pointer is pointing to? You need to cast the pointer to a proper type first:
int x = *(int*)lVptr;