How can I have a function duplicate each element in a list in C? [closed]

送分小仙女□ 提交于 2020-06-17 09:41:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!