strtoll: converts the string into a long long and returns the result
//Header file: #include <stdlib.h>
//Declaration: long long int strtoll(const char * restrict start, char ** restrict end, int radix);
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
int main(void)
{
char *end, *start = "100.00 AAA 200.00 BBBB";
end = start;
while(*start) {
printf("%f, ", strtoll (start, &end));
printf("Remainder: %s\n" ,end);
start = end;
while(!isdigit(*start) && *start)
start++;
}
return 0;
}
Related examples in the same category