I\'m not a C++ expert, but as far as I know this code should fail due to size not being constant:
size
#include using namespace std;
It's a C99 feature that allows you to declare arrays like that on the stack.