#include <iostream>
#include <array>
#include <cstring>
using namespace std;
int main ()
{
array<int,5> A ;
memset(A,0,sizeof A);
for(int i=0;i < 5;i++){
cout<<A[i]<<" ";
}
return 0;
}
When I run the program, compilation error occured.
But memset works well when I use int A[5]
instead of array<int,5> A
. Why memset is not working with container array as either way is used to define fixed size array?
Aucun commentaire:
Enregistrer un commentaire