2

Possible Duplicate:
C and C++ : Partial initialization of automatic structure

I'm looking for a fast way to init local array with zeros. (By "Fast", I mean "Fast to type.") When I do the following:

HANDLE hHandles[32] = {0};

does it zero out the first element or all 32?

Community
  • 1
  • 1
c00000fd
  • 20,994
  • 29
  • 177
  • 400

2 Answers2

4

It initializes all the 32 elements to zero.

Mahesh
  • 34,573
  • 20
  • 89
  • 115
1

See this surprisingly popular answer for details/alternatives. The difference between C and C++ seems to be that in C++ {} will do zero-initialization as well.

Community
  • 1
  • 1
aib
  • 45,516
  • 10
  • 73
  • 79