Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

2D array in C

Name: Anonymous 2012-02-01 8:30

If I have something like

char a[50][50];

Is something like this OK to do:

memset(a,0,2500);

In other words, does C make it into one array or is it actually an array of pointers?

Name: Anonymous 2012-02-01 9:49

>>10
No it's not fine at all, a is an array of 50 pointers to array of chars, so you're overwriting the 50 pointers and then you're stepping out of bounds.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List