Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误C2449和错误C2059_C - Fatal编程技术网

错误C2449和错误C2059

错误C2449和错误C2059,c,C,我正在尝试做一个关于打印带有上下边缘长度的梯形的程序。但是我不能执行我的代码来查看它是否工作。这是我的密码: #include <stdio.h> int main(void); { int top, bot, a, b; printf("Please enter the length of top:"); scanf("%d", &top); printf("Please enter the length of bottom:");

我正在尝试做一个关于打印带有上下边缘长度的梯形的程序。但是我不能执行我的代码来查看它是否工作。这是我的密码:

#include <stdio.h>

int main(void);
{
    int top, bot, a, b;

    printf("Please enter the length of top:");
     scanf("%d", &top);
    printf("Please enter the length of bottom:");
     scanf("%d", &bot);

for(a = top; a < bot; a++) {
    for(b = top; b < a+1; b++) {
        printf("* ");}
    printf("\n");}
 return 0;
}
#包括
int main(无效);
{
int top、bot、a、b;
printf(“请输入顶部的长度:”);
scanf(“%d”,顶部(&T);
printf(“请输入底部的长度:”);
scanf(“%d”和“bot”);
对于(a=top;a
这是我的错误信息: 错误C2059:语法错误:'}'

错误C2449:在文件作用域中找到“{”(缺少函数头?

删除
int main(void)
之后的
int main(void)
函数行中删除尾部的
,这是无效语法

int main(void) // this is wrong here: ';'
{
  ...
改变

int main(void);
int main(void) //no semicolon