#includeusing namespace std; int main(){ int arr[5] = {1, 2, 3, 4, 5}; int size = sizeof(arr)/sizeof(int); // determine array size cout << "Array size is: " << size << endl; return 0; }
#includeThis code will output: "Vector size is: 5" Package library: This code uses the package library "vector".#include using namespace std; int main(){ vector vec{1, 2, 3, 4, 5}; cout << "Vector size is: " << vec.size() << endl; return 0; }