サイトマップ / C言語講座>出入り口>総目次>目次:ヒープ領域>双方向リスト(ヘッダ)||ソース1||ソース2(出入り口)
#define MAX_ITEM_NAME 40
typedef struct item item; /* item という構造体に対して */
/* item というデータ型を宣言 */
struct item {
char name[MAX_ITEM_NAME + 1]; /* アイテム名 */
unsigned long prise; /* 値段 */
};
typedef struct shop shop; /* shop という構造体に対して */
/* shop というデータ型を宣言 */
struct shop {
item item;
shop *previous;
shop *next;
};
/* "Mem7.c の関数 */
shop *AddItem(shop *present); /* アイテムの追加 */
shop *RemoveItem(shop *present); /* アイテムの削除 */
void FreeAll(shop *head); /* malloc( ) で確保したメモリの終了時における解放 */
void ShowAllItem(shop *head); /* アイテムの一覧表示 */
void ShowPresentItem(shop *present); /* 現在対象になっているアイテムの表示 */
void main(void); /* コマンドの処理 */
/* File.c の関数 */
shop *ReadData(shop * head, FILE *fp); /* データの読み込み */
void *WriteItem(FILE *fp, shop *head); /* データの書き込み */
/* (C) 2000- YFプロ. All Rights Reserved. */ 提供:C言語講座−それ自体コンパイルできる教材を使った講座です−
サイトマップ / C言語講座>出入り口>総目次>目次:ヒープ領域>双方向リスト(ヘッダ)||ソース1||ソース2(出入り口)