?? mltliststack.h
字號:
#define M 10 /*M個鏈棧*/
#define TRUE 1
#define FALSE 0
typedef struct node
{
StackElementType data;
struct node *next;
}LinkStackNode, *LinkStack;
LinkStack top[M];
/*第i號棧的進棧操作*/
int pushi(LinkStack top[M],int i,StackElementType x)
{
/*將元素x進入第i號鏈棧*/
LinkStackNode *temp;
temp=(LinkStackNode * )malloc(sizeof(LinkStackNode));
if(temp==NULL)
return(FALSE); /* 申請空間失敗 */
temp->data=x;
temp->next=top[i]->next;
top[i]->next=temp; /* 修改當前棧頂指針 */
return(TRUE);
}
/*第i號棧元素的出棧操作*/
int Pop(LinkStack top[M],int i,StackElementType *x)
{
/* 將棧top的棧頂元素彈出,放到x所指的存儲空間中 */
LinkStackNode *temp;
temp=top[i]->next;
if(temp==NULL) /*第i號棧為空棧*/
return(FALSE);
top[i]->next=temp->next;
*x=temp->data;
free(temp); /* 釋放存儲空間 */
return(TRUE);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -