strndup
?
char tav = str[strlen(str)/2+1];
int a,b,anser;
char* as = strndup(str, strlen(str) / 2 - *str);
char* bs = strndup(str+ strlen(str) / 2 - *str+2, strlen(str) / 2 - *str);
a = atoi(as);
b = atoi(bs);
if (tav == '+')
anser = a + b;
else if (tav == '-')
anser == a - b;
else if (tav == '*')
anser == a * b;
else if (tav == '/')
anser == a / b;
puts(str);