fork download
  1. #include <iostream>
  2.  
  3. int main() {
  4. int array [] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  5. std::cout<< "Size of array: "<< sizeof(array)<< '\n';
  6. std::cout<< "Number of elements in array: "<< sizeof(array) / sizeof(array[0])<< '\n';
  7.  
  8. int *array_ptr = array;
  9.  
  10. std::cout<< "Size of array pointer: "<< sizeof(array_ptr)<< '\n';
  11. return 0;
  12. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Size of array: 40
Number of elements in array: 10
Size of array pointer: 4