Initializing a structure in c++ -
g++ 4.4.3
i have following structure api guide:
typedef struct network_info { int network_id; int count; } network_info, *network_info;
and in source code doing this:
network_info net_info = {};
is 2 curly braces initializing object of structure? initialize values to?
many advice,
this default-initialize fields of variable net_info
- set them both zero. that's handy one-liner used initialize struct
s don't have user-defined constructor instead of using memset()
.
Comments
Post a Comment