Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int getop(char s[]) {
- if(lp == lineLength) {
- lineLength = getline(line, MAXLINE);
- lp = 0;
- }
- if(lineLength == 0)
- return EOF;
- char c;
- int i;
- while((s[0] = c = line[lp++]) == ' ' || c == '\t')
- ;
- s[1] = '\0';
- if(!isdigit(c) && c != '.' && c != '-') {
- return c;
- }
- i = 0;
- if(c == '-') {
- if(isdigit(line[lp]) || line[lp] == '.') {
- c = line[lp];
- }
- else {
- return c;
- }
- }
- if(isdigit(c)) {
- while(isdigit((s[++i] = c = line[lp++])))
- ;
- }
- if(c == '.') {
- while(isdigit((s[++i] = c = line[lp++])))
- ;
- }
- lp--;
- return NUMBER;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement