www.thecareerplus.com
The CareerPlus
Home Technical Resources Programming Arrays and Pointers
Thursday 09th September 2010
 
 
What is a void pointer? Why can't we perform arithmetic on a void * pointer?

Discuss it!          



The void data type is used when no other data type is appropriate. A void pointer
is a pointer that may point to any kind of object at all. It is used when a pointer
must be specified but its type is unknown.
The compiler doesn't know the size of the pointed-to objects incase of a void * pointer.
Before performing arithmetic, convert the pointer either to char * or to the pointer
type you're trying to manipulate

Discuss it!          

CrackTheIntervew.NET
Advertisement
 
Top! Top!