del_tuple.c

来自「稀疏矩阵、链表、图、队列、二叉树、多叉树、排序、遗传算法等的实现」· C语言 代码 · 共 41 行

C
41
字号
/**************************************************************************
**  SP_DEL_TUPLE                                                         **
**                                                                       **
**    Delete a tuple                                                     **
**                                                                       **
**  INPUT:                                                               **
**    tuple -- The tuple which is to be deleted                          **
**                                                                       **
**  OUTPUT:                                                              **
**    void                                                               **
**                                                                       **
**  SIDE EFFECTS:                                                        **
**    None.                                                              **
**                                                                       **
**  NOTES:                                                               **
**                                                                       **
**************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include "sparse.h"

void sp_del_tuple(SP_TUPLE *tuple)
/* SP_TUPLE *tuple The tuple which is to be deleted */
{
  /* If the tuple is empty, then no deletion is necessary */
  if (tuple == (SP_TUPLE *)NULL)
  {
    return;
  }

  /* If there is data in the seq_stack, free it */
  if (tuple->seq != (int *)NULL)
  {
    free(tuple->seq);
  }

  free(tuple);
  return;
}

⌨️ 快捷键说明

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