I'm trying to allocate memory to my array but I get a crash.
int *cellWidth;
int cols = 50;
cellWidth=(int*)malloc(sizeof(int)*cols);
That's a pretty trimmed up version of my source, only the relevant lines out of it.
Anways I get a crash on XP pro, I gather it's a simple problem I tend to crash my programs with these memory things all the time but never really understood half of them except for the ones that go out of array bounds.



LinkBack URL
About LinkBacks



I was setting the variable before I had sized it which was causing the crash.