求解一 C++ 问题
#include <iostream>using namespace std;
void main()
{
void del_ch(char *,char);
char str[80],ch;
cout<<"Input a sting:\n";
cin.getline(str,80,'\n');
cout<<"Input the char deleted:\n";
cin>>ch;
del_ch(str,ch);
cout<<"Then the new sting is \n";
cout<<str<<endl;
}
void del_ch(char *p,char ch)
{
char *q=p;
for(;*p!='\0';p++)
if(*p!=ch)
{*q=*p;q++;}
*q='\0';
}
为什么被调函数中最后不需要return语句,不然结果怎么出?