Default constructor in C

后端 未结 13 719
孤街浪徒
孤街浪徒 2020-12-07 21:02

Is there a way to have some kind of default constructor (like a C++ one) for C user types defined with a structure?

I already have a macro which works like a fast in

13条回答
  •  星月不相逢
    2020-12-07 21:36

    No, not directly. The closest you could do is to write a function that allocated an instance and populated some of the fields.

提交回复
热议问题