How to convert each character in a character array to integer ? : I have tried the standard methods but still I get error in my answer.
For eg, with this code: 

int main()

{   

   int val;

   char str[]={'1','45','0'};

   val = str[1]-'0';

   printf("Int value = %d\n",val);

   return(0);

}


I am getting ans as 5 instead of 45.

How do I solve this issue? Plz help.