What does this mean in C/C++?

May 5, 2013 at 3:31am
1. typedef struct pq_item pq_item_t;

2. void *item;

//what is type void I have never seen
//void used like this...
May 5, 2013 at 4:01am
This looks like plain C to me. If you haven't been introduced to void I'm not sure you know what a C struct is. It's something that can hold several types of data. 2. is a generic pointer. Void is supposed to mean as it implies, nothing. Pointers are special variables that can hold memory addresses. Since it void(generic), it can point to any datatype. If it were something like int *item then it would only be able to point to integers.
May 5, 2013 at 4:08am
why typedef struct
and not just struct?
May 5, 2013 at 4:14am
May 5, 2013 at 4:19am
Thank you!
Topic archived. No new replies allowed.