那就是这样
// 初始化字符串str
char str[] = "I am a student!";
// 使用指针
char *p = str + 7;
// 输出"student!"
printf( "%s", p );
是VC++吗?如下:
#include
using namespace std;
int main()
{
char str[]="I am a student!";
char *p=&str[0];
while(*p!='s')
p++;
while(*p!=NULL)
{
cout<<*p;
p++;
}
cout<
}
如果是C改一下输出就可以了。
用C++写的,在vc++6.0上运行的
#include
#include
using namespace std;
int main()
{ char ch[]="computer";
char *com=ch;
for(int i=0;i
return 0;
}
输出结果是:
cmue
题目解释的不够明白。
是要把字符串I am a student按照空格分割成各个单词吗?