C++: Array Initialization C++ vs Java

typical local declaration (with 3 ints allocated in memory)
int x[3] = {1,2,3};

typical local declaration 2 (with 3 ints allocated in memory)
int x[] = {1,2,3};

local declaration with no initial values (with 3 ints allocated in memory)
int x[3]; // ok, initial values undefined

initialization of only SOME values (with 3 ints allocated in memory)
int x[3] = {1}; // x[1] = x[2] = 0

specify size but and initialize the rest to 0 (with 100 chars allocated in memory)
char c[100] = "hi"; // size = 100, c[2-99] = 0

implicitly specify size (with 3 chars allocated in memory)
char c[] = "hi"; // size = 3

No comments: