gpt4 book ai didi

c - c中函数的语法错误

转载 作者:行者123 更新时间:2023-11-30 21:46:04 25 4
gpt4 key购买 nike

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 15
int random_generator(int );

int arr_move(int);
int main()
{
int j, a, x,i,sayac;
int arr[N] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };



printf("Enter your start station(0-15): ");
scanf("%d", &a);
printf("My player is started from station-%d\n", a);
a = a - 1;


for (j = 0; j < N; j++)
{
arr_move(arr[N]);


while (arr[j] = 0)
for (i = 0; i < N; i++)
{
printf("%d", arr[i]);
printf("\n");
sayac += sayac;
}
while (x = 0)
printf("and visited all station after move");
return 0;
}


int random_generator(int random)
{

srand(time(NULL));
random=rand() % 3 ;
return 0;
}
int arr_move(int sarr[] , int b)
{
int num;

random_generator(5);
if (num = 0)
{
sarr[b - 1] += 1;
b = b - 1;
}
if (num = 1)
{
sarr[b] += 1;
b = b;
}
else
{
sarr[b + 1] += 1;
b = b + 1;
}
return 0;
}

缺少“;”在“键入”第 39 行之前,我的语法错误在哪里?我使用 89 Visual Studio 2010。我该如何修复它?我找不到错误在哪里所以感谢您的帮助...................................................... ......

最佳答案

   for (j = 0; j < N; j++)
{
arr_move(arr[N]);

main 函数中的此循环没有结束 }

此外,函数声明 int arr_move(int);arr_move 定义不匹配(不同的参数类型)。

关于c - c中函数的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27646539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com