问题
I want to write a subroutine with name duplicate C that duplicates each element in a list of integer elements. The list is stored as a linked list where the nodes are given by:
struct nodeEl {
int el;
struct nodeEl * next;
};
typedef struct nodeEl node;
List header (of type node *) is the parameter of the subroutine. For example, a list before and after a call is deduced: 4 5 7 3 → 4 4 5 5 7 7 3 3 The subroutine should be written without using library functions (except for malloc-free).
来源:https://stackoverflow.com/questions/62344321/how-can-i-have-a-function-duplicate-each-element-in-a-list-in-c