#include#include using namespace std; int main() { cout << "Size of int is " << sizeof(int) << " bytes"; return 0; }
#includeThis example calculates the size of an array by dividing the size of the array by the size of an integer. This gives us the number of elements in the array. Package library:#include using namespace std; int main() { int arr[] = {1,2,3,4,5}; int size = sizeof(arr)/sizeof(int); cout << "Size of array is " << size; return 0; }