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-07-02 19:37

>>15
sizeof(pointer) only equals sizeof(int) on certain architectures.  for example, some 64-bit architectures have a 64-bit pointer and a 32-bit integer...

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