C:交换功能(链表) [英] C: swap function (linked list)

查看:73
本文介绍了C:交换功能(链表)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要编写交换beteein项目的函数交换(* list,char X,char Y);


supose list:A - > B-> C - > D-> NULL


swap(list,A,B)


结果:



列表:B-> A-> C-> D-> NULL


禁止更改项目值。



TNX。 ..........

need to write function swap(*list,char X , char Y) that swap beteein items in liked list ;

supose list: A ->B->C->D->NULL

swap(list,A,B)

result:


list : B->A->C->D->NULL


changing value of items is forbidden .


TNX . ..........

推荐答案

创建一个函数,指向指向这两个节点的指针......然后交换这些指针。 。
Make a function that takes pointers to the pointers that point to these two nodes... then swap those pointers..


但它被单独列出。


它还好吗?
but it`s singly listed .

it`s alright ?


@sedaw


被谁禁止?我想这又是作业了;你告诉我们你尝试了什么,并向我们解释你遇到困难的地方,然后我们可能会试着帮助你。我们不会给你一个可复制和可以使用的勺子解决方案。


亲切的问候,


Jos
@sedaw
Forbidden by who? I guess this is homework again; you show us what you have tried and explain to us where you got stuck and then we might try to help you out. We are not going to give you a copyable and pastable spoonfed solution.

kind regards,

Jos


这篇关于C:交换功能(链表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆