Assign string to element in structure in C

后端 未结 5 1644
别跟我提以往
别跟我提以往 2020-12-06 21:03

I have this structure:

typedef struct SM_DB
{
    LIST_TYPE           link;
    char                name[SM_NAME_SIZE];
} SM_DB_TYPE;

And I

5条回答
  •  心在旅途
    2020-12-06 21:54

    You can assign value to string only while declaring it. You can not assign it later by using =.

    You have to use strcpy() function.

提交回复
热议问题