How to convert a string with mathematical operators to number (integer or float)
06:39 23 Jul 2018

I have a problem with converting a string like "(5+2)*3" to be able to evaluate to be 21.

Here is my code:

char inp[10];
printf("Write it: ");
scanf("%s", inp);
printf("Okay, computing!\n");
printf("INPUT: %s \n", inp);
printf("It's %d \n", (int)inp);

I would like to get a number at the end. This code is working:

printf("19+31 is '''%d'''", 19+31);

And i need to use the second argument - the 19+31 - to be my input.

The first code outputs this:

Write it: 4+4                                                                                
Okay, computing!                                                                             
INPUT: 4+4                                                                                   
It's 329554704
c math numbers