I have this code declaring an array of pointers and assigning value of 5 to the location that the first pointer in the array points to:
int *p[10];
*p[0]=5;
However, this is showing an EXC_BAD_ACCESS error. I tried
int **p = new int *[10];
*p[0]=5;
But this is giving the same error. How do I assign a value to the location pointed by an element of my array of pointers? Thank you.
Aucun commentaire:
Enregistrer un commentaire