Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   The meaning of the word generic (http://www.velocityreviews.com/forums/t440707-the-meaning-of-the-word-generic.html)

Albert 12-31-2005 01:00 AM

The meaning of the word generic
 
Hello all, I've got several questions and I'm sure you'll find them
easy to answer, but sadly I don't know the answers though:

What do people mean by generic pointers
Why is a pointer to void generic
Why would someone need pointers to void?

Thanks


Thad Smith 12-31-2005 07:55 AM

Re: The meaning of the word generic
 
Albert wrote:

> What do people mean by generic pointers


A pointer to an area of memory (if generic data pointer, rather than
function pointer) that may be used for different purposes.

> Why is a pointer to void generic


Because it doesn't point to a specific type of data, but can be
converted to a pointer to any data type.

> Why would someone need pointers to void?


One example is a pointer to the memory returned by malloc(). malloc()
doesn't know or care what the memory will be used for. It returns a
generic pointer that has type void*. Another example is the array
argument passed to qsort().

--
Thad


All times are GMT. The time now is 12:42 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.