1) You can use void* as the data part and then allocate memory separately
and use.
struct node
{
void* dataPtr;
struct node* next;
};
2) or Use embeddable lists:
http://isis.poly.edu/kulesh/stuff/src/klist/
Thanks,
Balaji.
On Wed, Mar 16, 2011 at 8:27 PM, himanshu kansal <
[email protected]> wrote:
> can nodes of linked list in c/c++ contain different types of
> data....means suppose 1st node of the list contains an integer value,
> 2nd contains a float,3rd has a string and so on......
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.