Convert char to int

This weeks assignment has to do with using a convert char to int. My problem is I don't have the slightest idea why you would want to do that or what you would use it for. I don't want the answers just any possible hints or pointers on how this function could be useful. Thanks!

Characters are really just 1 byte integers(0-256). The character representation is based off the ascii value. So you can directly assign the value of a character to an integer or return the value of it. Another method is to cast it to an integer.

I'm not sure what you are trying to do exactly.

Are you trying to change '0' to 0 or get the ascii value of any characters?

closed account (j3Rz8vqX)
One Idea:

String parsing may require you to be able to identify numeric content from other contents.

Ascii Reference:
http://www.asciitable.com/
Actually, the char type can store a value of -127 to 127. I think you're referring to an unsigned char that has a value from 0 to 255.

I pretty much agree with everything else you're saying.

----

Sometimes using datatypes that use the least memory are ideal for embedded systems where RAM is scarce.
Thanks everyone for your responses
Topic archived. No new replies allowed.