#include <stdio.h> #include <string.h> int main(){ char arr1[4]="abc"; char arr2[4]={'a','b','c','\0'}; printf("%s,---%s,%d\n",arr1,arr2,'\0'); arr1[0]='f'; arr1[1]='g'; arr1[2]='h'; arr1[3]='m'; printf("赋值后结果%s\n",arr1); strcpy(arr1,"123"); printf("第二次赋值后结果%s\n",arr1); return 0; }
|