Example scan function in c to print all digits
#include <stdio.h>
// Print all sequence of digits in a string in C
void print_all_digit(const char* input)
{
int on = 0;
goto BASE;
BASE:
switch(*input)
{
case '\0':
return;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
on = 1;
putc(*input++, stdout);
goto BASE;
default:
// Picks apart digit sequence by newline
if(on)
{
putc('\n', stdout);
on = 0;
}
input++;
goto BASE;
}
}
int main(void) {
print_all_digit(" . 56456 5 5 6 6 fjh43f89u93hdjdf354534fdjfjji5hfh54j43324jcjdshd9erf934urfh2r38f94u9u2f3jdif099 . fehwe33");
return 0;
}