10/22/2007

4.4 == 請同學練習找出下列程式錯誤之處並修正

#include

int maim( void ) {
float fMiles;
int iCount, iNum;
double dDist, dTemp;

/* [a] : Announce program

printf( "STORAGE.C will illustrate how variables are stored in memory \n" );
printf( "------------------------------------------------------------ \n" );

/* [b] : Now list variables and their addresses. */

printf( "\"fMiles\" occupies %i bytes of storage that begins at location %x\n",
sizeof( float ), &fMiles );

printf( "\"iCount\" occupies %i bytes of storage that begins at location %x\n",
sizeof( int ), &iCount );

printf( "\"iNum\" occupies %i bytes of storage that begins at location %x\n",
sizeof( int ), iNum );

printf( "\"dDist\" occupies %i bytes of storage that begins at location %x\n",
sizeof( double ), &dDist );

printf( "\"dTemp\" occupies %i bytes of storage that begins at location %x\n",
sizeof( double ), &dTemp );}
}

0 Comments:

張貼留言

<< Home