哈哈,自己想的考题,下次整你们,
#include <stdio.h>
#include <string.h>
int main ()
{
char string1[10] = { '\0' };
char string2[10] = { '\0' };
int i;
for (i = 0; i < 10; i++)
{
string1[i] = 'a';
}
strcpy (string2, string1);
printf("the string2 is %s\n", string2);
printf("the string1 is %s\n", string1);
return 0;
}
#include <stdio.h>
#include <string.h>
int main ()
{
char string2[10] = { '\0' };
char string1[10] = { '\0' };
int i;
for (i = 0; i < 10; i++)
{
string1[i] = 'a';
}
strcpy (string2, string1);
printf("the string2 is %s\n", string2);
printf("the string1 is %s\n", string1);
return 0;
}
posted on 2012-07-13 18:02 Richard.FreeBSD 阅读(162) 评论(0) 编辑 收藏 举报