int array[] = {4,78,3,7,9,2,56,2,76,23,6,2,1,645}; std::size_t length = sizeof(array)/sizeof(int); // see solution 1