home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C by Discovery (4th Edition)
/
C_By_Discovery_4th_Edition.tar
/
C_By_Discovery_4th_Edition
/
_DISK_
/
ch4
/
prob3.c
< prev
next >
Wrap
C/C++ Source or Header
|
2005-06-16
|
768b
|
26 lines
/* prob3.c
*
* Synopsis - Designed to input values into an array
* of three ints and then display the
* contents of that array. Has a bug in it.
* Objective - To provide practice debugging a program
* with a common mistake.
*/
/* Include Files */
#include <stdio.h>
int main( void )
{
int intarray[3], count;
printf( "intarray %x, &count %x.\n", intarray, &count );
for ( count = 0; count <= 3; count++ ) {
printf( "Cell #%d : ", count );
scanf( "%d", intarray+count );
}
printf( "The contents of the array are: " );
for ( count = 0; count <= 3; count++ )
printf( "%d\n", intarray[count] );
return 0;
}