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

sizeof

Name: Anonymous 2009-04-26 9:56

I have a function that relies on the sizeof statement to get the size of a constant array of unsigned bytes. Everytime I use the function the sizeof statement returns 4 regardless of the size of my array.

Here's the code that doesn't seem to work. The array argument is defined as a const u8 array[].

u8  c;
   
for(c = 0;c <= sizeof(array);++c){
    //do something here
}

Name: Anonymous 2009-04-26 15:19

>>1
const u8 array[]
Found your problem. If it's const, obviously it always has to be the same size.

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