I have this problem as a part of my c-programming project. I read users input to char type array (char*str) and I need to convert some parts of the string input to integer. The input might be "A smeagol 21 fire 22"
Here is some testing. I try to get x=40. This code's gives x=-4324242. Why this code don't work?
#include <stdio.h>
int main(){
    char *uga[1];
    uga[0] = "10";
    printf("%s\n", uga[0]);
    int x = 50 - (int)uga[0];
    printf("%d",x);     
}
Thank you beforehand.
 
     
     
     
     
     
    