When I declare a structure instance is it initialized or do I have to make a constructor?
How much will the constructor affect the performance since I need an array of 1000 structures?
The structure I need is very simple and it contains 4 integers. I need them to be initialized to 0.
This is my code:
struct MyStruct { int a; int b; int c; int d; MyStruct() : a(0), b(0), c(0), d(0) {} }; int main() { MyStruct array[1000]; }
MyStruct array[1000]()which will zero-initialize all the integers.declaration of 'array' as array of functionsAre you sure that's correct syntax?MyStruct array[1000]{}(which only works >=C++11)