為什么會(huì)報(bào)錯(cuò)呢
#include <stdio.h>
/* 定義say函數(shù) */
void say(char string) ? ? ? //數(shù)組參數(shù)應(yīng)該怎么寫呢?
{
? ? printf("%s\n",string); ? ? //打印字符串
}
int main()
{
? ? //定義字符串?dāng)?shù)組
? ? char string[] = "我在慕課網(wǎng)上學(xué)習(xí)IT技能!";
? ? say(string) ; ? ? ? ? ? ? ? //調(diào)用say函數(shù)輸出字符串
? ? return 0;
}
[Error] C:\Users\MB\Documents\C-Free\Temp\未命名8.cpp:12: error: invalid conversion from `char*' to `char'
[Error] C:\Users\MB\Documents\C-Free\Temp\未命名8.cpp:12: error: ? initializing argument 1 of `void say(char)'
2015-11-21