码迷,mamicode.com
首页 > 其他好文 > 详细

第八周 技术博客发表

时间:2016-04-28 21:22:49      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:

#include "stdafx.h"

#include "stdio.h"
#include "stdlib.h"

typedef int DataType;

typedef struct Space
{
 DataType data;
 Space* next;
}Space;

typedef struct Queue
{
 Space* base;
 Space* top;
 int length;
 
}Queue;

Queue* initQ()
{
 Queue *myQ;
 myQ=(Queue *)malloc(sizeof(Queue));
 myQ->length;
 myQ->base=(Space *)malloc(sizeof(Space));
 myQ->base->next=NULL;
 myQ->top=myQ->base;
 return myQ;
}

void insQ(Queue* myQ, DataType data)
{
 Space *temp=(Space *)malloc(sizeof(Space));
 temp->next=NULL;
 temp->data=data;
 myQ->top->next=temp;
 myQ->top->next=myQ->top->next->next;
 myQ->length++;
}

void remQ(Queue* myQ)
{
 if(myQ->length==0)
  printf("the queue is empty");
 Space* temp=myQ->base->next;
 myQ->base->next=myQ->base->next->next;
 free(temp);
 myQ->length--;
}

void getTop(Queue* myQ)
{
 printf("%d  \n",myQ->base->next->data );
}

 

int main(int argc, char const *argv[])
{
 /* code */
 return 0;
}

第八周 技术博客发表

标签:

原文地址:http://www.cnblogs.com/youu/p/5444259.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!