Chap. 1 : Unit 4 : Introduction to C Language: Part 6

कॅरेक्टर कॉन्स्टंट हा बेसीक डॆटा टाइप व त्याचा उपयोग करतांना प्रोग्रॅमर हमखास चुक करतात आणी मग बसतात शोधत प्रोग्रॅममधील errors. कारण एकच. या डेटा टाइप वापरण्याचे रुल्स खुप कमी आहेत. त्यामुळे विद्यार्थी सोप्प समजून दुर्लक्ष करतात आणी मग सी च्या स्ट्रींग चॅप्टर पर्यंत पुन्हा-पुन्हा अडचणीत येतात. म्हणूनच काळजीपुर्वक पहा…

We have seen how integers and real numbers can be stored. Now let’s study how alphabets, digits, and special characters on the keyboard can be stored in the memory. Digit here I mean digits 0 to 9 should not be confused with integers.

As seen earlier, data type is like a container…. For example we store water in a bottle or plastic pouch or a vessel but cannot store in a cloth bag. Whereas grains are stored in cloth bag or box but definitely not in a bottle…

Following are the rules of constructing a character constant

Various characters like T, &, *, # 6, can be stored in a character data types. While writing in a program it is enclosed in a pair of single quotes. For example t is stored as “opening single quote… t… closing single quote”.

Only one character can be written in a pair of single quote…exception is writing escape sequence.

Character constant takes one byte of memory under DOS environment….however UNICODE compatible compiler reserves 2 bytes of memory. So for one byte… range of character constant is -128 to +127

ASCII is an abbreviation of American Standard Code for Information Interchange. As characters are positive, 127 different characters can be stored in one byte which is quite enough for all characters on the keyboard. The ASCII standard has allocated one number to each character in the character set called an ASCII code.

For example capital A has an ASCII code as 65 and that of Capital B has ASCII code as 66…and so on… it means while you store capital A it is stored as 65 but in a binary format of 65. Nice know?

So ASCII codes for capital A to Z ranges from 65 to 90 and that of small a to z ranges from 97 to 122. ASCII code for digits 0 to 9 ranges from 48 to 57. All other ASCII codes have been distributed for various special characters from 0 to 46….58 to 64….91 to 96….and 123 to 127….

As character can never be negative, unsigned character can be stored and ASCII has made provision to allocate ASCII codes from 128 to 255 which is called as an extended ASCII character set.

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. please register for Discount Coupon


Leave a Reply

%d bloggers like this: