存放字符串的三种方法

 

#include <iostream> #include <string> //
使用 string
时添加的 using namespace std; int main() {        char ctr[]=”I am happy”;//
字符数组存放        string str=”I love china”;//
字符串变量存放        char * p=”I want to travele with you!”;//
字符指针存放        cout<<ctr<<endl;        cout<<str<<endl;        cout<<p<<endl;        return 0;

 

}

 

本文转自 韬光星夜 51CTO博客,原文链接:http://blog.51cto.com/xfqxj/477111,如需转载请自行联系原作者

    原文作者:weixin_34408624
    原文地址: https://blog.csdn.net/weixin_34408624/article/details/89833588
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞