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
  • 19,418
  • 22
  • 150
  • 359

2 Answers2

4

It initializes all the 32 elements to zero.

Mahesh
  • 33,625
  • 17
  • 84
  • 113
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
  • 43,251
  • 10
  • 70
  • 78