/ 48.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
using namespace std;
int main()
{
char str[10];
char* strip = str;
//输入输出
cout << "str=";
cin >> str;//用字符数组输入字符串
cout << "str=" << str << endl;
cout << "strip=" << strip << endl;
cout << "strip=";
cin >> strip;//用字符指针变量输入字符串
cout << "str=" << str << endl;
cout << "strip=" << strip << endl;
//利用指针变量改变其指向字符串的内容
*(strip + 2) = 'l';
cout << "str=" << str << endl;
cout << "strip=" << strip << endl;
//动态为字符型指针变量分配内存
strip = new char(100);
cout << "strip=";
cin >> strip;//用字符指针变量输入字符串
cout << "str=" << str << endl;
cout << "strip=" << strip << endl;
}
1-为什么指针变量strip能通过cin赋值
2-为什么cout输出的strip而不是*strip输出的是str的值而不是地址
3- strip = new char(100);是什么意思
4-str[10]不是只有10个位置一个汉字占两个字符串结尾还有\n,而且我输入的“程序执行将在此处开始并结束”有13个汉字他为什么能正常输出