I'm new to C programming and I have to write a program that picks up only the integers from the standard input and output them as tokens. Anything else should be outputted as "illegal". I'm not permitted to use any arrays or malloc, and I could only declare ints or long ints. I must use getchar() for input and printf() for output and nothing else. My question is, how do I read input byte at a time, convert them to tokens and check if they are ints?
For example: If the input is:
Hello 45 World Thank 67 you
It should output:
illegal
45
illegal
illegal
67
illegal