尝试声明字符串数组时c语言出错
error in c language when trying to declare array of strings
我试图用 C 语言声明这个字符串数组(或者我认为是一个二维字符数组),但是编译器 ide 给我错误:“[错误] 数组类型具有不完整的元素类型“
char division[][]={"Northeast Division","Northwest Division","Southeast Division","Southwest Division"};
我做错了什么?
您必须指定字符串的最大长度。这应该可以解决您的问题
char division[][25]={"Northeast Division","Northwest Division","Southeast Division","Southwest Division"};
你可以这样声明:
char *division[]={"Northeast Division","Northwest Division","Southeast Division","Southwest Division"};
我试图用 C 语言声明这个字符串数组(或者我认为是一个二维字符数组),但是编译器 ide 给我错误:“[错误] 数组类型具有不完整的元素类型“
char division[][]={"Northeast Division","Northwest Division","Southeast Division","Southwest Division"};
我做错了什么?
您必须指定字符串的最大长度。这应该可以解决您的问题
char division[][25]={"Northeast Division","Northwest Division","Southeast Division","Southwest Division"};
你可以这样声明:
char *division[]={"Northeast Division","Northwest Division","Southeast Division","Southwest Division"};