c - ")" token 和 C 错误之前的预期表达式错误 - 错误 : expected expression before ']' token

标签 c data-structures deque

这是我的代码:

#include <stdio.h>
#include <conio.h>
#define MAX 10;

int rradhe[MAX];
int koka = -1;
int bishti = -1;

void shto_djathas()
{
int element;

if ((koka == 0 && bishti == MAX -1 )||koka ==  bishti +1)
{
    printf("\nGjendje Overflow");
    getch ();int rradhe[MAX];
int koka = -1;
int bishti = -1;
    return;
}
if (koka == -1)
{
    koka = 0;
    bishti = 0;
}
else
    if (koka == MAX -1)
    bishti = 0;
else
    bishti = bishti + 1;
    printf ("\n Shtypni elementin qe doni te shtoni ");
    scanf ("%d", &element);
}

void main () {
    int c;
while(1){
printf("---------------------------");
printf("\nDetyre Kursi - Ivi Hysenbelli , Olsi Lala");
printf("\n 1 - Shtoni element ne rradhe"); // elementet do te shtohen nga e djatha
printf("\n 2 - Hiq element nga e djatha(Nga fillimi)");
printf("\n 3 - Hiq element nga e majta(Nga fundi)");
printf("\n 4 - Afisho rradhen");
scanf("%d",&c);
switch (c) {

case 1:
    shto_djathas();
    break;



}

}
}

我不明白为什么会向我显示此错误。

错误代码在线 5. 13. 16. 27 我几乎尝试了所有方法并阅读了太多论坛,但我不明白为什么。 这是我在 c 中的第一个双端队列。我是 c 编程的新手,我将非常感谢您的帮助。 提前致谢。

附:对不起我的英语

最佳答案

从宏定义中删除分号

#define MAX 10; 应为 #define MAX 10

并了解原因 not to use semicolon in the end of macro .

关于c - ")" token 和 C 错误之前的预期表达式错误 - 错误 : expected expression before ']' token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21452213/

相关文章:

c - 按位移位使我的程序停止?

有人能解释一下为什么这个 C 代码没有编译我的 else if 语句吗?

c - TCP套接字编程

python - 这个双端队列在 python 中是线程安全的吗?

arrays - 给定数组 A 和数字 K 创建数组 B,其中 B[i] = min(A[i], A[i+1].. A[i + K - 1])

c - __stack_size__, __stack_end__ 符号在 'C'

c++ - 将 C++ 头文件转换为 Python

java - 通过大量键值对进行过滤和排序(java)

java - 在 Java 中表示线程注释的最有效数据结构?

java - java 中的双端队列实现中我的类型未定义方法