This is homework for school. I have a struct Employee that looks like this
typedef struct TEmployee
{
struct TEmployee * m_Next;
struct TEmployee * m_Bak;
char * m_Name;
} TEMPLOYEE;
and a function to add a new employee that currently looks like this but I'm not sure how to make the m_Bak point to the previous employee
TEMPLOYEE * newEmployee(const char * name, TEMPLOYEE * next)
{
TEMPLOYEE* head = NULL;
head = malloc(sizeof(TEMPLOYEE));
if(head==NULL)
{
return NULL;
}
head -> m_Name = strdup(name);
head -> m_Next = next;
head -> m_Bak = NULL;
return head;
}
Any help is appreciated.