为什么我会收到错误错误:'char'之前的预期表达式?(Why do i get the error error: expected expression before ‘char’?)
#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’
#include <stdio.h> #include <stdlib.h> #include <time.h>
This is my function that prints an array of 10 by 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"); } }
The function that uses the above function. I get one error here.
void findThecookie(){ drawMap(char map[10][10], int i, int j); }
This is my main function.
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(); }
Another error here
if(gamenumber == 4){ findThecookie(char map[10][10], int i, int j); } if(gamenumber == 5){ printf("Exiting the program\n"); } return 0;
Everytime i try to compile i get the errors
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’
原文:https://stackoverflow.com/questions/19438150
满意答案
下面应该做的诀窍,其中A1是你正在寻找的值,B1是范围的下限,C1是范围的上限。 您可能在<或>之前/之后不需要'=',它仍然具有相同的结果。
=IF(A1<=B1,B1,IF(A1>=C1,C1,A1))
The below should do the trick, where A1 is the value you're looking for, B1 is the lower bound of the range, C1 is the upper bound of the range. You probably don't need the '=' before/after the < or >, it still has the same result.
=IF(A1<=B1,B1,IF(A1>=C1,C1,A1))
相关问答
更多如何限制一个数字的范围(How to limit a number to a range)
如何使用公式计算excel [Range]中的数字出现次数?(How to count a number occurence in an excel [Range] using formula?)
如何从range()函数获取最后一个数字?(How do I get the last number from the range() function?)
如果超出范围的数字返回范围的极值,那么Excel中是否有任何函数给出数字和范围?(Is there any function in Excel that give a number and a range if the number out of a range return the extreme value of the range else the number ?)
将数字限制在一个范围内(Limiting a number to a range)
移动数字范围的中点(Shift Middle Point of Number Range)
选择范围内的范围(selecting a range within a range)
检查数字是否在范围内(Check if number is in range)
相关文章
更多error C2668: 'M' : ambiguous call to overloaded function
eclipse里报:An internal error occurred during:
The connection to adb is down, and a severe error has occured.
solr error logs org.apache.solr.common.SolrException: ERROR: [doc=17] unknown field alias
命令行运行Hbase: Session 0x0 for server null, unexpected error
solr 4.4 Error filterStart 问题
Solr安装异常:SolrException: Error loading class 'solr.VelocityResponseWriter'
[Hadoop] Error: JAVA_HOME is not set
Solr/Lucene escape char handling
win8安装VirtualBox-4.2.18提示Installation failed!error:系统找不到指定的路径
最新问答
更多python的访问器方法有哪些
使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
透明度错误IE11(Transparency bug IE11)
linux的基本操作命令。。。
响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)
在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)
NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)
元素上的盒子阴影行为(box-shadow behaviour on elements)
它看起来像只在Windows上的Chrome的错误。 我在Google Canary (Chrome 63)中也进行了测试,问题依然存在,所以有可能它不会很快修复。 这个问题是由overflow: auto引起的overflow: auto ,在你的情况下,它可以很容易地通过删除或设置为可见(默认)来解决。 但是 ,将鼠标悬停在右侧(顶部和底部)时,会出现滚动条。 一个解决方案可以设置overflow: hidden的身体,所以预期的结果是所需的。 我想指出,这不是一个很好的解决方案,但我建议暂
Laravel检查是否存在记录(Laravel Checking If a Record Exists)
这取决于您是否要以后与用户合作,或仅检查是否存在。 如果要使用用户对象(如果存在): $user = User::where('email', '=', Input::get('email'))->first(); if ($user === null) { // user doesn't exist } 如果你只想检查 if (User::where('email', '=', Input::get('email'))->count() > 0) { // user found
设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
$scope.getData= function () { var reader = new FileReader(); reader.onload = $('input[type=file]')[0].files; var img = new Image(); img.src =(reader.onload[0].result); img.onload = function() { if(this.width > 640
Copyright ©2023
peixunduo.com All
Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!
Laravel检查是否存在记录(Laravel Checking If a Record Exists)
设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!