Why don't you use templates ?
template class T
class LNode
{
public:
LNode(T pData,LNode *pNext):data(pData),next(pNext){}
T data;
LNode *next;
};
template class T
class LList
{
protected:
LNodeT *head;
LNodeT *tail;
public:
LList()
{
head=tail=NULL;
}
void push_back(T pData)
{
this way u can do it in c creation and printing of generic lisk list .
void(List **p,void *data, unsigned int n)
{
List *temp;
int i;
/* Error check is ignored */
temp = malloc(sizeof(List));
temp-data = malloc(n);
for (i = 0; i n; i++)
*(char *)(temp-data +
in case of generic link list when u have to create the node u have to copy
the data part character by character ie always one -one byte and in this
way whatever be the data type of ur data u can easily get the data and
u will keep doing this until the size of the data that to entered .
On Thu,
how to implement generioc linked list..using void pointer...i havent
used void pointer much so, m not able to use it properly in linked
list..please help asap !!!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send