Struct initialization of the C/C++ programming language?

前端 未结 5 1537
无人及你
无人及你 2020-11-27 21:46

I could do struct initialization with code:

struct struct_type_id struct_name_id = { value1, value2, value3 };

but could not with:

5条回答
  •  伪装坚强ぢ
    2020-11-27 22:16

    I faced a similar problem, and the solution to that was that I was trying to initialized the struct outside the function(not using the initializer syntax, but with the obj.member = VALUE; notation). It is a related problem, so posting here, hoping someone with the same question lands up here.

提交回复
热议问题