What is the difference between these two declarations?
int myints[5];
array<int,5> myints;
If I use the first declarations and the function size(), there will be a error "Member reference base type 'int [5]' is not a structure or union". But if I use the second declarations and the function size(), the program works. Why would the first declarations does not work?
#include <iostream>
#include <iomanip>
#include <array>
using namespace std;
int main()
{
//int myints[5]; //illegal
array<int,5> myints; //legal
cout << "size of myints: " << myints.size() << endl; //Error if I use the first declarations
cout << "sizeof(myints): " << sizeof(myints) << endl;
}