Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct unit {
- int data[20];
- struct unit *next;
- } unit;
- unit *copy(unit *start) {
- unit *newstart, *newrunning;
- for (newstart = newrunning = NULL; start != NULL; start = start->next) {
- unit *p = (unit*)malloc(sizeof(unit));
- *p = *start;
- p->next = NULL;
- if (newstart==NULL)
- newstart = newrunning = p;
- else {
- newrunning->next = p;
- newrunning = newrunning->next;
- }
- }
- return newrunning;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement