将字符串I am a student!赋给一个字符数组,然后输出该串中的student!。请用指针完

大题来的..就好有完整步骤.谢谢
2025-12-18 01:48:19
推荐回答(4个)
回答1:

那就是这样
// 初始化字符串str
char str[] = "I am a student!";
// 使用指针
char *p = str + 7;
// 输出"student!"
printf( "%s", p );

回答2:

是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< return 0;
}

如果是C改一下输出就可以了。

回答3:

用C++写的,在vc++6.0上运行的
#include
#include

using namespace std;
int main()
{ char ch[]="computer";
char *com=ch;
for(int i=0;i cout<<*(com+i);
return 0;

}
输出结果是:
cmue

回答4:

题目解释的不够明白。
是要把字符串I am a student按照空格分割成各个单词吗?