随手记1

普通指针无法指向字符串常量       必须用const;  如const char * a = “string”;

输入字符串变量时:

1、方式一:char str[100];

        cin.getline(str,100);

 

输出字符串常量时:

1、方式一:char str[100]="sjadjksadkj";

         cout<<"str[100]"<<str<<endl;

 

原文地址:https://www.cnblogs.com/gc612/p/9905467.html