自己写的一个入栈程序

来源:互联网 发布:如何手机网络定位找人 编辑:程序博客网 时间:2024/05/05 19:35
#include <iostream>using namespace std;typedef struct student{int data;struct student* next;}node;typedef struct stackqueue{node *di,*top;}queue;queue *pushQ(queue *q,int data){node *n=(node*)malloc(sizeof(node));//缺了*n->data=data;n->next=NULL;if (q->di==NULL)//注意这个不是*q->di{q->di=n;q->top=n;}else{q->top->next=n;q->top=n;}return q;}


 

0 0
原创粉丝点击