Your parsing goals look very modest. Your code is all ANSI C so maybe this is really a C question.
If the expressions you want to accept are number op number where number is any decimal value and "op" is one of the usual math operators like +, -, *, / ... take a look at the strtod function. It's like atof, only better.
strtod - C++ Reference[
^]
This function will parse a number - given a character pointer, and return another pointer that points to *after* that number.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char text[] = "123.0+456.0";
char *cursor = text;
double term1 = strtod(cursor, &cursor);
char op = *cursor++;
if (!op)
return 2;
double term2 = strtod(cursor, &cursor);
double result = 0.f;
switch (op)
{
case '+':
result = term1 + term2;
break;
case '-':
result = term1 - term2;
break;
case '*':
result = term1 * term2;
break;
case '/':
result = term1 / term2;
break;
default:
return 1;
}
printf("%f%c%f=%f\n", term1, op, term2, result);
return 0;
}
This code is meant to express an idea - not be a complete solution. It does not consider divide by zero, white space, or more complex expressions. I hope it leads you in a better direction.