// Applying sizeof to an array name returns
// the number of bytes in the array.
#include <stdio.h>
#define SIZE 20
size_t getSize( float *ptr ); // prototype
int main( void )
{
float array[ SIZE ]; // create array
printf( "The number of bytes in the array is %u"
"\nThe number of bytes returned by getSize is %u\n",
sizeof( array ), getSize( array ) );
} // end main
// return size of ptr
size_t getSize( float *ptr )
{
return sizeof( ptr );
} // end function getSize






0 comments:
Post a Comment