0

How can i solve this problem (c)

Here's a peek ahead. In this chapter you learned about inte- gers and the type int. C can also represent uppercase letters, lowercase letters and a considerable variety of special symbols. Cuses small integers internally to represent each different character. The set of characters a computer uses together with the corresponding integer representations for those characters is called that computer's character set. You can print the integer equivalent of uppercase A, for example, by executing the statement printf( "Xd", 'A' ); 2.29 Write a C program that prints the integer equivalents of some uppercase letters, lowercase letters, digits and special symbols. As a minimum, determine the integer equivalents of the following: ABCabc012 s *+ / and the blank character.

24th Mar 2021, 12:34 AM
Batuhan Yurtsever
Batuhan Yurtsever - avatar
2 Answers
+ 4
printf("Xd",''A'); should raise an error... however: printf("%d",''A'); will print the char code of 'A' ^^ uppercase letters starts at 65 (A) and are in alphabetic order continuously from there. similarly lowercase letter starts at 96. digits starts at 48. blank ('space') character is at 32 (first printable character). to get other symbols chars either use printf to view their char code or refer to an ASCII table: range from 0 to 127 (0 to 31 are character controls -- non printable -- and 127 is reserved). above the ASCII range, other less common char could be found... but requires eithee selecting a language specific code page (extended ASCII up to 255) or use of unicode and some multi-byte encoding format (usually utf-8 on non microsoft window terminal, utf-16 used internally by most of --at least high level -- programming languages such as python, javascript).
24th Mar 2021, 1:49 AM
visph
visph - avatar
0
ASCII (American Standard Code for Information Interchange) table: http://www.asciitable.com/mobile/
24th Mar 2021, 1:52 AM
visph
visph - avatar