MCQs
Because void pointer is used to cast the variables only, So pointer arithemetic can't be
done in a void pointer.
In this program, we are just adding the two values and printing it.
Output:
$ g++ poi.cpp
$ a.out
8
0xbfef0378
We just casted this from void to int, so it prints 5
Output:
$ g++ poi1.cpp
$ a.out
5
Because the data points to the address value of the variables only, So it is printing the memory
address of these two variable.
Output:
$ g++ poi2.cpp
$ a.out
the data points to the integer value0xbfc81824 the data now points to the character0xbfc8182f
The void pointer is easily converted to any other type of pointer, so these are equal.
Output:
$ g++ poi4.cpp
$ a.out
equal
None.
By casting the pointer to another data type, it can dereferenced from void pointer.
None.
Because it doesn't know the type of object it is pointing to, So it can point to all objects.