Creating object arrays for VC++
I need to create an array of objects when I click a button in Visual C++. I am having some difficulty doing so. Any help would be appreciated.
---Code within button click---
Code:
PictureBox* picBlocks[];
for(int i = 0; i < 5; i++)
{
picBlocks[i] = new PictureBox();
pnlGameField->Controls->Add(picBlocks[i]);
}
When I run it, it gives me an error about an unhandled exception.
Debug stops at the last line of code. I'm still quite a beginner, so I'm not exactly sure what to look for.
Thanks