Tuesday, July 14, 2009

Diffrence between generic pointer and pointer in c language?

1. Generic pointer is nothing but void*.


2. A generic pointer/void* can be easily type casted to the desired datatype.


3. Main differenc between the generic pointer and pointer of specific datatype: The void* is capable of pointing to the variable of any datatype whereas pointer of specific datatype say int* can point only to the variable of type int.


4. Generic pointer is also used for taking the address of the variable alone.


4. Whenever you are using void*, typecasting is required to perform the operation on the content that void* points to.


5. Be careful when you are doing any arithmetic operation with void*.


No comments:

Post a Comment