#include <stdio.h>
#include <stdlib.h>
#include <time.h>这是我的函数,它打印一个10乘10‘的数组。
void drawMap(char map[10][10]){
int i, j;
printf("Now drawing map\n");
for(i = 0; i < 10; i++){
for(j = 0; j < 10; j++){
map[i][j] = '.';
printf("%c ", map[i][j]);
}
printf("\n");
}
}使用上述函数的函数。我这里有一个错误。
void findThecookie(){
drawMap(char map[10][10], int i, int j);
}这是我的主要功能。
int main()
{
int gamenumber;
int randomNumber;
int guessednum;
printf("Hello and welcome to my babysitting game.\n");
printf("Please select your option. Your choices are:\n");
printf("1) Number guessing game\n" "2) Rock-Paper-Scissors\n" "3) Area of a Random Rectangle\n" "4) Find the Cookie\n" "5) Quit\n");
scanf("%d", &gamenumber);
if(gamenumber == 1){
numberGuessing();
}
if(gamenumber == 2){
rockPaperscissors();
}
if(gamenumber == 3){
randomRectangle();
}这里还有一个错误
if(gamenumber == 4){
findThecookie(char map[10][10], int i, int j);
}
if(gamenumber == 5){
printf("Exiting the program\n");
}
return 0;每次我试图编译时,我都会得到错误
project2.c: In function ‘findThecookie’:
project2.c:22:9: error: expected expression before ‘char’
project2.c: In function ‘main’:
project2.c:171:17: error: expected expression before ‘char’发布于 2013-10-17 22:16:57
您的代码有几处问题:
阅读:functions.htm,这是一个关于在C中使用函数的基本教程!
发布于 2013-10-17 22:12:56
drawMap()接受一个参数作为输入,但是您提供了3个参数。
https://stackoverflow.com/questions/19438150
复制相似问题