【发布时间】:2011-05-20 18:04:53
【问题描述】:
为什么下面的代码会产生编译时错误?我似乎不明白为什么类型不匹配。
typedef char f_string[MAX_CHARS+1] ; /* string for each field */
/*
* A parsed CSV line, with the number of fields and upto MAX_FIELDS themselves.
*/
typedef struct {
int nfields ; /* 0 => end of file */
f_string field[MAX_FIELDS] ; /* array of strings for fields */
} csv_line;
....
csv_line sut;
sut.field[0] = "Name, "; //Compile-time error.
错误是:
error: incompatible types in assignment
【问题讨论】:
标签: c struct compiler-errors