'Reading Spaces from expression

int a;
char exp[a];
char oper;
int op1=0;
int op2=0;
int i = 0;

printf("Enter Expression: ");
scanf("%s", exp);
signed int result=0;
while(*(exp+i) != '\0')
{
    if(i == 0)
    op1 = *(exp+i++) - '0';
    oper = *(exp+i++);
    op2 = *(exp+i++) - '0';
    switch(oper)
    {
        case '+': op1 = op1 + op2;
            break;

        case '-': op1 = op1 - op2;
            break;

        case '*': op1 = op1 * op2;
            break;

        case '/': op1 = op1 / op2;
            break;
    }
    result=op1;

}


printf("______________Task 1_________________\n");
printf("Result: %d\n", result);

**The code takes in an expression and reads it from left to right to solve it. After the code will take that result and with a base turn it into a radix. How can allow my code to read spaces within the inputed expression **

c


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source