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 structs don't have user-defined constructor instead of using memset().


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -