c - 在C中实现队列

标签 c data-structures queue implementation

struct client
{
char Fname[20];
char Lname[20];
char home_num[10];
char cell_num[10];
char email_add[20];
int client_id;
}; /* ending the client struct*/

char Main_Menu()
{
 char sel;

 int rear=-1;
 int front=-1;
 client clientQueue [size]; -->I keep having an error come up right here, not sure why.
 int isFull(int rear);
 int isEmpty(int rear);

我收到错误的地方是我声明队列的行。 不太确定为什么我会收到该错误,因为当我研究时,我发现了这一点。 p.s尺寸为20

最佳答案

如果这是纯C,则必须使用struct-关键字

struct client clientQueue [size]; 

并且size也必须在某个地方定义。

或者使用typedef,例如

typedef struct client {
    char Fname[20];
    char Lname[20];
    char home_num[10];
    char cell_num[10];
    char email_add[20];
    int client_id;
} client; 

关于c - 在C中实现队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15819352/

相关文章:

Visual Studio 中的 C 程序

c - 将屏幕拆分为 ncurses 和非 ncurses 区域

java - java中的原始数据类型是如何定义/编写的?

java - 为什么我的迭代器 foreach 循环永远不会进入/执行?

c - 如何在while循环中处理多个相似条件?

c - GDB:如何解释 x86_64 调用堆栈和寄存器(特别是 $rbp)

C++: std::vector 两端保留空间

ruby-on-rails - 如何将不同的 Controller ID 变量 'car' 链接到父标题/链接主题?

c# - 队列 ForEach 循环抛出 InvalidOperationException

java - 持久映射映射到队列以实现公平调度?