+ 1
Why only one of the two parts compiles at a time but not both ?
Either Array of 'ptr' compiles or array of 'a' compiles but not both ..why is so ? https://code.sololearn.com/cCsLCKkave5M/?ref=app
7 Réponses
+ 18
Krishna Kumar In your code
int *ptr[10] is an array of 10 pointers. Even if we assign address of array a to the ptr then also it will give compilation error because rest of the array of pointers is empty.
+ 2
Again, seems to work fine on my computer. Sololearn does give an error though.
+ 1
I don't know, it compiles on my computer. It may be something in sololearn's compiler settings.
+ 1
~ swim ~ Jackson O’Donnell
Sorry I had attached a wrong code ...please refer to the corrected code again !
+ 1
Night_fury~
No ,if we convert the last printf statement into comment then the addresses of pointers in the ptr array are displayed irrespective of any intialization to ptr