传递指针参数到函数的几个问题
#include <iostream>
#include <string>
using namespace std;
void showError(char * message="aaaaaa")
{
cout<<endl<<message<<endl;
}
void main()
{
showError();
char cc[10]="cccc";
showError(&cc[0]);
showError("bbbbb");
string str="dddd";
showError(&str);
}
1)参数为指针便量应传递一个变量值的首地址,为什么showError("bbbbb");也正确
2) string str="dddd";
showError(&str); 如何用string