Hello everyone!
I'm now having some problems with linked lists. Here is the exercise:
EMPL: employee
antig: here it says how many years the employee has been working in this company
Code:
#include <stdio.h>
#include <stdlib.h>
typedef struct EMPL{
char NAME[20];
int antig;
struct EMPL *next;
struct EMPL *nextAntig;
}TEMPL;
struct COMPANY{
char PLACE[10];
TEMPL *PRIM;
};
COMPANY VE[100];
TEMPL *LPA = NULL;
void create_list_empl(COMPANY v[], TEMPL **L);
int main()
{
INS_LISTS_EMPL(VE);
create_list_empl(VE, &LPA);
}
But when I try to run this, it has 2 errors:
Code:
void create_list_empl(COMPANY v[], TEMPL **L);
it says 'unknown type name COMPANY' in both cases
What I have to do is to call the function
Code:
create_list_empl(VE, &LPA);
where LPA points to the list of employees sorted by antig using the pointer nextAntig
I can't use auxiliar structs (arrays, lists or auxiliar files)
Here's a draw of the exercise:
This what I think I have to do (I don't know if I'm right). I don't know with the pointers where I put a '?'. And I also don't know how to do the sort like I draw.
I know how to work with double pointers and I know how to do some easy exercises, but this is too difficult for me..
Can you please help me, telling me from where can I study or how to do something?
Thanks!
Juan