[Courses] sizeof operator

millward millward at ms.umanitoba.ca
Tue Feb 14 17:03:08 UTC 2012


 When I define an integer array, such as
  int array[40];
 the sizeof operator can detect the correct 
 number of bytes which make up the array
  int number_of_bytes = sizeof( array );
 How does the sizeof operator do this ?
 I can see how sizeof finds the correct byte 
 size of a  char array since it ends
 with a nul '\0' but as far as I know, the integer
 array has no special character to end it.
    How does this sizeof operator work ?


More information about the Courses mailing list