條件編譯的目的;防止頭文件被重複包含。
#sqlist.h
#ifndef SQLIST_H__ //如果沒有包含SQLIST_H__,則下一條語句去定義宏名/宏體
#define SQLIST_H__ //此處define宏名SQLIST_H__,後面的所有內容爲宏體
#define DATASIZE 1024
typedef int datatype
typedef struct node_st
{
datatype data[DATASIZE];
int last; //last here used as a counter.
};sqlist;
sqllist *sqlist_create(); //create linear table
void sqllist_create1(sqlist **); //return void if create failed
int sqlist_insert(sqlist *,int i,datatype *); // add data
int sqlist_delete(sqlist *,int i);
int sqlist_find(sqlist *,datatype *); //1st parameter "sqlist *" is current linktable, 2nd parameter is datatye
int sqlist_isempty(sqlist *);
int sqllist_setempty(sqlist *);
int sqlist_getnum(sqlist *);
int sqlist_union(sqlist *,sqlist *);
int sqlist_destroy(sqlist *); //return int if destroy succed
#endif
book@100ask:~/C_coding/CH03/arr$ make test1
cc test1.c -o test1
book@100ask:~/C_coding/CH03/arr$ ./test