//SeqStack.h
typedefstructstack
{
DATAdata[SIZE+1];//数据元素
inttop;//栈顶
}SeqStack;
SeqStack*SeqStackInit()
{
SeqStack*p;
if(p=(SeqStack*)(malloc)(sizeof(SeqStack)))//申请栈内存
{
p->top=0;//设置栈顶为零
returnp;//返回指向栈的指针
}
returnN..
分类:
其他好文 时间:
2015-04-30 01:12:54
阅读次数:
205
这一系列博客的特点就是——给出每趟排序的结果本来想着好好写一下过程,弄个图片什么的,不过觉得网上的解析太多了,都比较好,所以这些博客就算是对自己的总结吧。#include<stdio.h>
#include<limits.h>
#include<malloc.h>
inta[10]={2,8,5,7,4,3,1,9,6,..
分类:
编程语言 时间:
2015-04-29 20:00:47
阅读次数:
172
//SeqStack.h
typedefstructstack
{
DATAdata[SIZE+1];//数据元素
inttop;//栈顶
}SeqStack;
SeqStack*SeqStackInit()
{
SeqStack*p;
if(p=(SeqStack*)(malloc)(sizeof(SeqStack)))//申请栈内存
{
p->top=0;//设置栈顶为零
returnp;//返回指向栈的指针
}
returnN..
分类:
其他好文 时间:
2015-04-29 07:24:06
阅读次数:
130
//SeqStack.h
typedefstructstack
{
DATAdata[SIZE+1];//数据元素
inttop;//栈顶
}SeqStack;
SeqStack*SeqStackInit()
{
SeqStack*p;
if(p=(SeqStack*)(malloc)(sizeof(SeqStack)))//申请栈内存
{
p->top=0;//设置栈顶为零
returnp;//返回指向栈的指针
}
returnN..
分类:
其他好文 时间:
2015-04-29 07:23:27
阅读次数:
114
今天调试程序遇到下面一个错误:
unexpected end of file found in comment
#include"List.h"
void InitList(List *list)
{
Node *s = (Node *)malloc(sizeof(Node));
assert(s != NULL);
s->next = NULL;
list->first = lis...
分类:
其他好文 时间:
2015-04-28 21:02:31
阅读次数:
154
//顺序队列操作
#defineQUEUEMAX15
typedefstruct
{
DATAdata[QUEUEMAX];//队列数组
inthead;//队头
inttail;//队尾
}SeqQueue;
SeqQueue*SeqQueueInit()
{
SeqQueue*q;
if(q=(SeqQueue*)malloc(sizeof)(SeqQueue))//申请保存队列的内存
{
q->head=0;//设置队头
q..
分类:
其他好文 时间:
2015-04-28 18:48:44
阅读次数:
127
//循环队列
//CycQueue.h
#defineQUEUEMAX15
typedefstruct
{
DATAdata[QUEUEMAX];//队列数组
inthead;//队头
inttail;//队尾
}CycQueue;
CycQueue*CycQueueInit()
{
CycQueue*q;
if(q=(CycQueue*)malloc(sizeof(CycQueue)))//申请保存队列的内存
{
q->head=0;//设..
分类:
其他好文 时间:
2015-04-28 18:44:35
阅读次数:
128
//循环队列
//CycQueue.h
#defineQUEUEMAX15
typedefstruct
{
DATAdata[QUEUEMAX];//队列数组
inthead;//队头
inttail;//队尾
}CycQueue;
CycQueue*CycQueueInit()
{
CycQueue*q;
if(q=(CycQueue*)malloc(sizeof(CycQueue)))//申请保存队列的内存
{
q->head=0;//设..
分类:
其他好文 时间:
2015-04-28 18:42:40
阅读次数:
134
char *p="hello";
*p='k'; //编译能通过,但是运行到这里会出错
因为p指向的是一个字符串常量. 所以运行时发现要改常量区就会报错.
改成:
char* p = (char*)malloc(6);
strcpy(p,"hello");
*p='k';
....
free(p);...
分类:
其他好文 时间:
2015-04-28 18:22:20
阅读次数:
105
首先看上一篇博客关于类创建对象的问题:http://www.cnblogs.com/xumenger/p/4462975.html联想到通过指针分配内存 我们通过指针动态分配了内存之后,需要记住这个指针(该指针指向分配的内存),比如C/C++中的int *pi;pi =(int*) malloc(....
分类:
编程语言 时间:
2015-04-28 15:52:27
阅读次数:
191