c++ - Initializing an Array using Size of Operator? -
i have array initialize
char arr[sizeof(int)]; would expression evaluate compile time constant or result in function call?
char arr[sizeof(int)]; as far language concerned, fine, though array declared (and defined), not initialized if local variable. if declared @ namespace level, statically zero-initialized.
note sizeof(int) constant expression of size_t type; value known @ compile time.
Comments
Post a Comment