Mega Code Archive

 
Categories / C++ / Data Type
 

Get array length with sizeof function

#include <algorithm> #include <iostream> #include <iterator> #include <vector> using namespace std; int main(){    const int a[] = { 98, 7, 54, 69, 87, 88, 56, 92, 77,39, };    const int len = sizeof( a ) / sizeof( a[0] ); }