Closed jaybdub closed 10 years ago
The following does not compile
typedef struct _Simple { bool has_name; char name[20]; } Simple; Simple msg; msg.name = "Bob"
Error is something like :
char[3] cannot be set to char[20].
Instead, use strcpy of strncpy (which adds overflow protection I think?)
strcpy(msg.name,"bob");
or
strncpy(msg.name,"bob",sizeof(msg.name));
The following does not compile
Error is something like :
char[3] cannot be set to char[20].