10/15/2007

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

int main( void ) {
char cName;
float fMiles;
int iCount;
double dDist;

/* [a] : Announce program */

printf( "STORAGE1.C : print size of basic data types \n" );
printf( "------------------------------------------- \n" );

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

printf( "\"cName" occupies %2i bytes of storage\n", sizeof( char ));
printf( ""fMiles\" occupies %2i bytes of storage\n", sizeof( float ));
printf( ""iCount" occupies %2i bytes of storage\n", sizeof( int ));
printf( ""dDist" occupies %2i bytes of storage\n", sizeof( double ));

0 Comments:

張貼留言

<< Home