这两个函数具体有什么区别,能帮我分析一下吗
能帮我分析一下 char &replace(int k){return s[k];} 和 char *rep(int k) {return &s[k];}的区别吗#include<iostream>
using namespace std;
char s[80]="Hello World";
char &replace(int k){return s[k];}
char *rep(int k) {return &s[k];}
void main(){
replace(11)='!';
cout<<rep(0)<<endl;
cout<<replace(11)<<endl;
*rep(5)='+';
cout<<rep(0)<<endl;
cout<<replace(6)<<endl;
}