In C, Void pointer( void * ) is an generic data type. There are times when you write a function but do not know the datatype of the returned value. When this is the case, you can use a void pointer.
int func(void *Ptr);
main()
{
char *Str = "abc";
func(Str);
}
int func(void *Ptr)
{
printf("%s\n", Ptr);
}
Note:
You cant do pointer arithmatic on void pointers.
No comments:
Post a Comment