sl_free.m

来自「data structures C programs」· M 代码 · 共 25 行

M
25
字号
function head=sl_free(sl)
% SL_FREE
%
%  head=SL_FREE(sl) frees the memory allocated to the singly linked
%  list head.

% Copyright (c) MathWorks Inc. 1998-2001. All rights reserved.

if nargin<1
  error('one input argument required.');
end
if nargout<1
  error('one output argument required.');
end

head=sl.head;
while head~=0
  headnext=head.next;
  free(head);
  head=headnext;
end
sl.head=0;
sl.tail=0;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?