sl_puta.m
来自「data structures C programs」· M 代码 · 共 31 行
M
31 行
function sl=sl_puta(sl,node,data)
% SL_PUTA
%
% sl=SL_PUTA(sl,node,data) adds data after node in the singly
% linked list sl.
%
% To put an element
% at start of list: sl_puta(sl,sl.head,data).
% at end of list: sl_puta(sl,sl.tail,data).
%
% There is no limitation of data type, and different nodes can
% contain different data types.
% Copyright (c) MathWorks Inc. 1998-2001. All rights reserved.
if nargin<3
error('three input arguments required.');
end
if nargout<1
error('one output argument required.');
end
new_node=pointer;
new_node.data=data;
new_node.next=node.next;
node.next=new_node;
if node==sl.tail
sl.tail=new_node;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?