一、
#include<stdio.h>
int main()
{
char arr1[] = "abcdef";
char arr2[] = { 'a','b','c','d','e','f' ,'\0'};
char arr3[] = { 'a','b','c','d','e','f' };
printf("%s\n", arr1);
printf("%s\n", arr2);
printf("%s\n", arr3);
return 0;
}
二、
#include<stdio.h>
#include<string.h>
int main()
{
int len = strlen("abc");
char arr[] = { '1','2','3','4','5','6','7','8' ,'\0'};
char arr1[] = { '1','2','3','4','5','6','7','8' };
char arr2[] = "abcdef";
char arr3[] = { 'a','b','c','d','e','f','\0'};//“\0”作为字符串结束标志
printf("%d\n", len);
printf("%d\n", strlen(arr));
printf("%d,\n", strlen(arr1));
printf("%d\n", strlen(arr2));
printf("%d\n", strlen(arr3));
return 0;
}
三、