太平鸟2017秋冬大秀:C++中,函数调用不可以使用字符串作为参数吗?
来源:百度文库 编辑:高考问答 时间:2024/05/03 00:43:38
C++中,函数调用不可以使用字符串作为参数吗?
C++ 有字符串吗?
你只有 char * 可以用。
可以呀~! 函数是通值传递来时现的,而字符串它也是值,所以说是可以的.
#include<iostream.h>
int sun(string &s)
{
cout<<s;
return 1;
}
void main()
{
string *p;
p="asdf";
sun(*p);
}