fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. void printSize(std::string months[12])
  5. {
  6. std::cout << "sizeof(months) = " << sizeof(months) << "\n";
  7. std::cout << "sizeof(months[0]) = " << sizeof(months[0]) << "\n";
  8. std::cout << "months / months[0] = " << (sizeof(months) / sizeof(months[0])) << std::endl;
  9. }
  10.  
  11. int main()
  12. {
  13. std::string months[12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
  14. printSize(months);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
sizeof(months) = 8
sizeof(months[0]) = 32
months / months[0] = 0