c++ - How to get an array's size? -


there array :

... int score[3]; ... score[0] = 6; score[1] = 4; score[2] = 7; 

how array's number of elements ? ( here obvious want ask question in general )

several ways:

  • std::distance(std::begin(score), std::end(score))
  • std::extent<decltype(score)>::value
  • c++17 (n4280): std::size(score)

see this answer.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -