method 1

struct node
{
   void* data;
   unsigned int size;
   struct node* next;
};
struct node* allocateNode(void* data,unsigned int n)
{
     struct node* temp = (struct node*) malloc(sizeof(struct node));
     temp->size = n;
     temp->next = NULL;
     temp->data = malloc(n);
     for(int i=0;i<n;i++)
         *((char*)temp->data + i) = *((char*)data+i);
}

method 2

struct node{
      int kind; /* int, float ,char */
      union{
           int a;
           float b;
           char c; /* others can be added*/
      } data;
      struct node* next;
}


On Wed, Mar 16, 2011 at 11:24 PM, hary rathor <harry.rat...@gmail.com>wrote:

> @DON:
>  pls can U explain with examle ?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Sanjay Ahuja
Department of Computer Science & Engineering
IIT Guwahati

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to