The meaning of the word generic

A

Albert

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
 
T

Thad Smith

Albert said:
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().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top