#include <iostream>
using namespace std;
void fun(char*, char*, int);
int main()
{
char str1[100]="I am a student",str2[100];
int m;
cin>>m;
fun(str1,str2,m);
cout<<str2<<endl;
return 0;
}
void fun(char* p1, char* p2, int m)
{
int i=0,j=0,num;
while(*(p1+i)!='\0')i++; // 求字符串长度;
num=i; //把字符串长度赋给num;
while(m<=num) //当第m个字符小于字符串长度时;
{
*(p2+j)=*(p1+m); //重新复制;
j++;
m++;
} //循环直到条件成立;
}
using namespace std;
void fun(char*, char*, int);
int main()
{
}
void fun(char* p1, char* p2, int m)
{
}
![](http://hi.csdn.net/attachment/201203/5/0_1330946286P2pM.gif)