一个在不同的编译器下会有不同结果的C++程序(程序本身只有四行)

    技术2022-05-11  78

    1. char * str1="hello";  char * str2="hello";  *str1='p';  cout<<str2<<str1<<endl;

    问执行结果?

    这是在论坛上看到的一个例子,很有趣。

    如果将程序改为如下,就什么问题都没有了

    1. char * str1="hello";  char * str2="hello_kitty";  *str1='p';  cout<<str2<<str1<<endl;

    问执行结果?


    最新回复(0)