char* s与char s[]的区别

#include<iostream>
using namespace std;
char* func() {
    char* s = "abc";//正常
    //char s[] = "abc";//乱码
    return s;
}
int main(){
    char* t = func();
    cout << t << endl;
    system("pause");
    return 0;
}

猜你喜欢

转载自blog.csdn.net/cj1064789374/article/details/104215774