Mcq doubt in q2

Q­2 which of the following statement(s) best refer to pointers?

A) Pointer arithmetic is permitted on pointers of any type.

B) A c pointer of type void can be used to directly examine or modify
any object of any type

C) A c pointer knows the types of pointers and indirectly referenced
data items at runtime

D) All of above

A. Pointer arithmetic is permitted on pointers of all type.(except void as its size is fixed and position)
B. We first need to do casting before using void pointer.
C. A c pointer knows the types of pointers and indirectly referenced data items at runtime. Before using the pointer its datatype must be known. So, it knows the type of data it can point to.
Also, the *p (referenced data item i.e. the value stored at the location pointed by it) is accessed at the time of execution or at the time , when we are using it.
As described A is wrong (as void does not allow arithmetic, B is Also wrong as need to do casting before using, Only C is correct )

sir but here in option c not always it is possible to know the type as if the data type is void * than how is refercencing possible at run time???

void * is also a type. You just need to know that the type is identified during the runtime.

sir as void is also type but void means data type is unknown so how is referencing q possible ??? how will the compiler know to consume 4 byte or 1 byte from memory and void means we dont know the data type isnt it??

void does not actually mean that data type is unknown. It is still another data type. The void data type has no values and no operations. It’s a data type that represents the lack of a data type .
And also void type variables uses 4 bytes of memory.

sir my doubt is so can we say that void pointer is a pointer which actually is not used to fetch while runtime but it can be used for storing the address is it like that???

Yes its used to store address.
You can read more about it from here

void pointers can be explicitly type casted to any other datatype and this process also completes during runtime.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.