Why an error??
Managed C++/CLI
2
Posts
2
Posters
2
Views
1
Watching
-
__gc struct hello{ int x; int y; }; void main() { hello* st[]= new hello* [5]; st[0]->x=199; }
You have simply created an array. But you haven't created the individual array members yet! Use the following code :-
__gc struct hello
{
int x;
int y;
};int _tmain(void)
{
hello *st[]= new hello*[5];
for(int i=0; i<5; i++)
st[i] = new hello();
st[0]->x = 100;
return 0;
}Regards, Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]