queue.c

来自「用于计算矩阵的特征值,及矩阵的其他运算.可以用与稀疏矩阵」· C语言 代码 · 共 45 行

C
45
字号
#include	<stdio.h>#include	<malloc.h>#include	"csa_types.h"extern	char	*nomem_msg;queue	q_create(size)unsigned	size;{queue	q;void	exit();q = (queue) malloc(sizeof(struct queue_st));if (q == NULL)  {  (void) fprintf(stderr,nomem_msg);  exit(9);  }q->storage = (char **) malloc(sizeof(lhs_ptr) * (size + 1));if (q->storage == NULL)  {  (void) fprintf(stderr,nomem_msg);  exit(9);  }q->end = q->storage + size;q->tail = q->head = q->storage;q->max_size = size;return(q);}char	*deq(q)queue	q;{char	*p;p = *(q->head);if (q->head == q->end) q->head = q->storage;else q->head++;return(p);}

⌨️ 快捷键说明

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