C语言字符串数组赋值的方式有以下几种:
char str1[] = "Hello"; char str2[] = {'H', 'e', 'l', 'l', 'o', '\0'}; char str3[6] = "Hello";  char str1[10]; char str2[] = "Hello"; strcpy(str1, str2);  char str[6]; str[0] = 'H'; str[1] = 'e'; str[2] = 'l'; str[3] = 'l'; str[4] = 'o'; str[5] = '\0';  char str[6]; str = "Hello"; // 错误,字符串数组不能直接赋值  这种方式是错误的,因为字符串数组是一个指针常量,不能直接赋值给它。
需要注意的是,字符串数组的大小必须足够容纳字符串及其结束符’\0’,否则会导致溢出错误。