第1个回答 2015-12-02
#include<stdio.h>
#include <string.h>//使用strcpy()函数
int main(void)
{
char a[30] = "abcdert";
char b[] = "hdskljgh;glh";
char c[30];
printf("%s\n", a);
printf("%s\n", b);
printf("赋值输出到 a 数组 %s\n", strcpy(a, b));
printf("赋值输出到 c 数组 %s\n", strcpy(c, b));
printf("%s\n", b);
return 0 ;
}
/*
* 定义函数:char *strcpy(char *dest, const char *src);
函数说明:strcpy()会将参数src 字符串拷贝至参数dest 所指的地址。
返回值:返回参数dest 的字符串起始地址
*/本回答被网友采纳
第2个回答 2015-12-02
//#include "stdafx.h"//If the vc++6.0, with this line.
#include "stdio.h"
int main(void){
char *a="1234567890abcdefghijklmnopqrstuvwxyz",b[37],*pa,*pb;
pa=a,pb=b;
while(*pb++=*pa++);//把a复制到b
printf("%s\n",b);//Look at...
return 0;
}
第3个回答 2015-12-02
那就遍历一下呗,a字符串中的每个字符赋给b字符,OK了