- C Programming Allows you to Manipulate on String
- Whenever the Character is variable is used in the expression then it is automatically Converted into Integer Value called ASCII value
- All Characters can be Manipulated with that Integer Value.(Addition,Subtraction)
- ASCII value of : 'a' is 97
- ASCII value of : 'z' is 121
Possible Ways of Manipulation :
Way 1: Displays ASCII value[ Note that %d in Printf ]
Way 2 : Displays Character value[ Note that %c in Printf ]char x = 'a'; printf("%d",x); // Display Result = 97
Way 3 : Displays Next ASCII value[ Note that %d in Printf ]char x = 'a'; printf("%c",x); // Display Result = a
Way 4 Displays Next Character value[Note that %c in Printf ]char x = 'a' + 1 ; printf("%d",x); // Display Result = 98 ( ascii of 'b' )
Way 5 : Displays Difference between 2 ASCII in Integer[Note %d in Printf ]char x = 'a' + 1; printf("%c",x); // Display Result = 'b'
Way 6 : Displays Difference between 2 ASCII in Char [Note that %c in Printf ]char x = 'z' - 'a'; printf("%d",x); /* Display Result = 25 (difference between ASCII of z and a ) */
char x = 'z' - 'a'; printf("%c",x); /* Display Result = ↓ ( difference between ASCII of z and a ) */
0 Comments:
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email