Regarding conversion of values

Hi sir. I don’t know anything about like u convert ascii into integer.Can u pls provide some material or link so that I can properly learn it.

Hello @Hk199977,

ASCII: Short for American Standard Code for Information Inter-exchange, ASCII is a standard that assigns letters, numbers, and other characters in the 256 slots available in the 8-bit code. The ASCII decimal (Dec) number is created from binary, which is the language of all computers. As shown in the table below, the lowercase “h” character (Char) has a decimal value of 104, which is “01101000” in binary.
image

image

As you know, the size of char is 8-bits(or 1 byte).
So, we can represent 256 different characters using these 8 bits.
ASCII has assigned a separate decimal number to each of these 256 characters to uniquely represent/identify them in memory.

Common:
digits: 58-67
capital alphabets: 65-90
lower alphabets: 97-122

NOTES:

  1. char c=‘9’;
    int n;
    n=c; //This will store it’s corresponding ASCII number i.e. 67.

    If you wants to store 9 instead of it’s ASCII number.
    n=c-‘0’;
    Reason:
    67-58=9.

  2. if you want to convert smaller alphabet to capital then subtract 32 from it.
    Example:
    char c1=‘a’;
    char c2;
    c2=c1-32;

    For reverse, add 32.
    Reason:
    lower alphabets differ by 32 positions from their corresponding capital alphabets.

Hope, this would help.
Give a like if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.