If have a Sring char *t="39";
how can I convert it to a number ?
so I can add subtract from it can I use cast here?
This is a discussion on Strings within the C Programming forums, part of the General Programming Boards category; If have a Sring char *t="39"; how can I convert it to a number ? so I can add subtract ...
If have a Sring char *t="39";
how can I convert it to a number ?
so I can add subtract from it can I use cast here?
You cannot cast it. There is a function atoi() which you could use. Or else write your own function. Take a digit, determine it's place and multiply it with 10^place. And add all the results. Like:
3 * 10^1 + 9 * 10^0 = 39