Hello,
I'm trying to figure out how to take an array of char and a char ** expression as parameters and have the function convert a sequence of digits it finds to type int and return the converted value, and set the contents of its second parameter ( a char * value) to point to the first character in the array that was not converted. For example if the array contained the string 555jack then after the call, the output would contain the value 555 and point to the 'j' in the string. This is what i have so far but stuck now as to what to do or add:
#include <string.h>
#include <stdio.h>
int conv( char [], char **);
int main(void)
{
int intval;
char array [80], *remainder;
char *string = "555 jack \n ";
printf (string);
while ( gets( array ) !=NULL ) {
intval = conv( array, &remainder );
printf( " %d, %s\n", intval, remainder);
}
system("PAUSE");
return 0;
}
Any kind of help would be very appreciated. Thank you for your time.
Jack