Hello stackover flow community, I'm trying initialize two empty array of pointers but getting this error on Visual Studio 2013:
Unhandled exception at 0x011C5E9C in 45CProject.exe: 0xC0000005: Access violation writing location 0x00000000.
Here is my code:
#include <iostream>
using namespace std;
int main(){
int* a[10] = { nullptr };
int* b[10] = { nullptr };
*a[0] = 2;
*b[0] = 4;
cout << "a[0] = " << *a[0] << endl;
cout << "b[0] = " << *b[0] << endl;
return 0;
}
Much Appreciated!