/*
*用指针输出字符串并计算字符串的长度
*/
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
char* p, * q;
p = new char[100];
cout << p;
gets_s(p);
q = p;
cout << "输出每个字符:";
while (*p != 0)
cout << *p++ << " ";
cout << "\n字符串长度:" << p-q;
return(0);
}
gets_s(p);
->
gets_s(p, 100);