tags:

views:

24

answers:

1

Hello,

g++ 4.4.3

I have the following structure from a API guide:

typedef struct NETWORK_INFO
{
    int network_id;
    int count;
} NETWORK_INFO, *NETWORK_INFO;

And in the source code they are doing this:

NETWORK_INFO net_info = {};

Is the 2 curly braces initializing the object of the structure? But what would it initialize the values to?

Many thanks for any advice,

+2  A: 

This will default-initialize all fields of variable net_info - set them both to zero. That's a handy one-liner used to initialize structs that don't have a user-defined constructor instead of using memset().

sharptooth