#include struct Foo { int a; int b; int c; }; struct Bar { int x; Foo f; int y; }; int main(int argc, char** argv) { // initialize the members Bar r = {1, {2, 3, 4}, 5}; std::cout << r.x << " "; std::cout << r.f.a << " "; std::cout << r.f.b << " "; std::cout << r.f.c << " "; std::cout << r.y << " "; std::cout << "\n" << std::endl; // zero initialize the structure Bar r2 = {}; std::cout << r2.x << " "; std::cout << r2.f.a << " "; std::cout << r2.f.b << " "; std::cout << r2.f.c << " "; std::cout << r2.y << " "; std::cout << "\n" << std::endl; // initialize first 3 members and 0 initialize the remaining elements int a1[8] = { 1, 2, 3 }; for (int i = 0; i < 8 ; ++i) { std::cout << a1[i] << " "; } std::cout << "\n" << std::endl; // zero initialize the entire array int a2[5][5] = { }; for (int i = 0; i < 25 ; ++i) { std::cout << a2[i/5][i%5] << " "; } std::cout << "\n" << std::endl; return 0; }