首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

动态分配有关问题。寻找大神。

2012-09-10 
动态分配问题。。。寻找大神。。。大神,下面的函数里Error()和FatalError()是什么东西?是函数吗?如果是函数,那么

动态分配问题。。。寻找大神。。。
大神,下面的函数里Error()和FatalError()是什么东西?是函数吗?如果是函数,那么它的作用是什么?在哪个头文件里?

谢谢!!!!!


#include<stdio.h>

#include<malloc.h>

#define MinTableSize 3.14

enum KindOfEntry{ Legitimate, Empty,Delete };

struct HashEntry
{
int Element;
enum KindOfEntry Info;
};

typedef struct HashEntry Cell;

struct HashTbl
{
int TableSize;
Cell *TheCells;
};

typedef struct HashTbl HashTable;

HashTable *InlitializeTable( int TableSize )
{
if( TableSize < MinTableSize )
{
Error( "TableSize is too small" );
return NULL;
}

HashTable *H = ( HashTable * )malloc( struct HashTbl );
if( H == NULL )
{
FatalError( "Out Of Space!!!" );
}

H->TableSize = 17;
H->TheCells = ( Cell * )malloc( sizeof( Cell ) * H->TableSize );
if( H->TheCells == NULL )
{
FatalError( "Out Of Space!!!" );
return NULL;
}

int i;
for( i = 0; i < H->TableSize ; ++i )
{
H->TheCells[i].Info = Empty;
}
return H;
}



[解决办法]
可能是函数,也可能是#define,楼主贴的代码不全吧。
[解决办法]
按照这样大写的,一般都是宏
也可能是函数,但大多数情况下是宏
[解决办法]
不清楚什么原因,看看大家是怎么说的
[解决办法]
函数?宏定义?

热点排行