直接看代码:
#include <stdio.h>
#include <stdlib.h>
//宏定义相关常量
#define Max 10
#define Size 10
typedef struct Sqlist{
int *data;
int length;//长度
}Sqlist;//顺序表
typedef struct HashSqlist{
int *data;
int length;
}HashSqlist;//哈希表
int hash (int key){
return key%10;
} //哈希函数
void InitSqlist(Sqlist &l){
//这里l 还没定义,所以要加 &
printf("Please int the length of the hashTable\n");
scanf("%d",&l.length);
l.data = (int *)malloc (Max * sizeof(int));
printf("Please int %d numbers\n",l.</