i got a homework problem. i'm learning on my own but still you'd probably consider it homework. anyway i'm not understanding this programming exercise... what is it asking me to do exactly?
so what i need to know iswrite a function that skips over input until encountering a digit. store that digit and subsequent digits into a string until encountering a nondigit. place that character back into input and convert the string to an int. the function should use a pointer argument to supply the number value. return EOF if the function encounters end of file, otherwise return 1. use getc() and ungetc(). in short, the function should read the int from input such as this: be22again.
1) what input are they talking about? just stdin? or do i pass a stream pointer (though it doesn't say so)?
2) under what condition does the function return 1? it returns EOF if that's encountered, but otherwise how does it know when to stop looking? does it search ALL input from stdin until it finds an int and then return 1 when the int terminates? but what if the user doesn't simulate EOF?
3) am i totally wrong? i just want to know what exactly i'm supposed to do...