home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C by Discovery (4th Edition)
/
C_By_Discovery_4th_Edition.tar
/
C_By_Discovery_4th_Edition
/
_DISK_
/
ch5
/
testconv.c
< prev
next >
Wrap
C/C++ Source or Header
|
2005-06-16
|
894b
|
36 lines
/* testconv.c
*
* Synopsis - Inputs lines with fgets() and passes
* the string to conv(). Displays the
* value returned by conv() and the
* remainder of the string.
*
* Objective - To provide a test program for the
* user-written function to convert a
* string of digits to type int.
*/
/* Include Files */
#include <stdio.h>
#include <string.h>
/* Constant Definitions */
#define LGTH 80
/* Function Prototypes */
int conv( char [], char ** );
/* Fill in your PRECONDITION and POSTCONDITION here. */
int main( void )
{
int intval;
char array[LGTH], *remainder;
while ( fgets( array, LGTH, stdin ) != NULL ) {
intval = conv( array, &remainder );
printf( " %d, %s\n", intval, remainder );
}
return 0;
}