Get array length with sizeof function : sizeof « Data Type « C++






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] );

}
  
    
  








Related examples in the same category

1.Determining the Size of Variable Types