int a[] = {3, 2, 3, 5, 7, 5, 9 ,2};std::vector vec(a, a+sizeof(a)/sizeof(int) );std::sort(vec.begin(), vec.end() );vector::iterator iter_end;iter_end ...
分类:
编程语言 时间:
2015-04-29 15:01:29
阅读次数:
140
二维数组:
1)定义形如int a[2][3],此时a代表的是这个二维数组的地址,sizeof(a)为24。
二级指针:
1)定义形如int **p:表示为指向指针的指针
2)二级指针不能和二维数组替换,如int aa[2][3],**a;a=aa;是错误的,但可以用int (*a)[3];a=aa替换。
指针数组:
1)定义形如int *p[5]:表示含有五个指针元素的数组、又称为二维...
分类:
编程语言 时间:
2015-04-29 13:39:28
阅读次数:
173
//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
第三章:1,sozeof(int); int n_int=INT_MAX; sizeof n_int;(对变量括号可选)2,#include包含一些类型的最大值3,count 默认显示十进制, coutint main(){ using namespace std; const int i=20;....
分类:
编程语言 时间:
2015-04-29 00:19:14
阅读次数:
291
一、sizeof sizeof(...)是运算符,在头文件中typedef为unsigned int,其值在编译时即计算好了,参数可以是数组、指针、类型、对象、函数等。 它的功能是:获得保证能容纳实现所建立的最大对象的字节大小。 由于在编译时计算,因此sizeof不能用来返回动态分配的内存空间的大小...
分类:
其他好文 时间:
2015-04-28 22:15:22
阅读次数:
170
今天调试程序遇到下面一个错误:
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