Default constructor in C

后端 未结 13 670
孤街浪徒
孤街浪徒 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:45

    No, structs are nothing but a bunch of data. You cannot declare functions within the structs, so there is no way to create a constructor for it.

提交回复
热议问题