1

这是我的问题:我需要实现一个 FIFO/LIFO 列表堆栈作为 ADT 物种 1。我的程序是模块化的,它有一个item.h模块:

    #ifndef ITEM_H_INCLUDED
    #define ITEM_H_INCLUDED

    typedef struct
    {
        char stringa[20];
        int numero;
    } Item;        
    #endif // ITEM_H_INCLUDED

head.h模块:

#ifndef HEAD_H_INCLUDED
#define HEAD_H_INCLUDED

#include <stdio.h>
#include <stdlib.h>

#include "item.h"  

void QUEUEinit();
int QUEUEempty();
void QUEUEput_top(Item);
void QUEUEput_bottom(Item);
Item QUEUEget_top();
Item QUEUEget_bottom();

#endif // HEAD_H_INCLUDED

main.c和data.c;我需要的是我如何声明 aQEUEnode struct和在哪里。

感谢您的帮助 :)

4

1 回答 1

1

由于您的 QUEUE* 函数都没有收到 a ,因此您可以将它与它们操作QUEUEnode *的 一起隐藏在 head.c 文件中。QUEUEnode root;

如果你想使用多个队列,那么它可能应该在 head.h 文件中,以便可以在 main.c 中创建它们。为此,您还需要修改函数以接受要操作的队列。

于 2013-04-30T16:41:54.997 回答