Introduction to C Language Part 4

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

कॉंन्स्टंट चे विविध प्रकार पाहील्या नंतर तो कसा तयार करायचा हे महत्वाचे. वरकरणी प्रत्येक नवीन प्रोग्रॅमरला हे खुप सोप्प आणी कमी महत्वाच वाटत. पण गरज आहे ती त्याचे नियम समजावून घेण्याची.enlightened कारण नियम कोणते हे प्रथम माहीत हवं. अर्थात नेहमीच्या आयुश्यात आपण काही किंवा अनेक नियम मोडत असलो winkतरी इथे मात्र पाळायलाच लागतात नाहीतर मग दंड भरायचा Error आणी Warning च्या रुपामध्ये…!smiley

If we want to store integer constant, Let’s try to understand integer data type…. rules to build integer data type and a few examples. Whole Numbers like 45, 78, 3245, -756, 0, -23 are integer constants.

Usually following rules must be followed while constructing an Integer data type.

It could be either negative or positive. For example +78 or -345 are integers

Default sign is positive. For example 56 is positive integer

It must be a digit. For example “Seven” is not an integer but 7 is an integer

It cannot contain blank space. So 45 is valid integer but 98 225 52 114  is not a valid integer constant…

I repeat It cannot contain blank space, for example 45 is valid integer but 98 225 52 114  is not a valid integer constant

It cannot contain any special character not even a comma. For example 4 thousand 785 is not a valid integer

Under the DOS platform it takes 2 bytes of memory

Its range is -32768 to +32767

I repeat its range is -32768 to +32767

For creating integer variable int is the reserved word called keyword…

Now the question is how these numbers are stored in the memory…suppose we wish to store 79.

As we know, it is a decimal number which is built on base 10 numbering system. As seen before… data on the memory is always stored in 1–0 format called binary or base 2 numbering system.

Divide 79 by 2, we get remainder as a 1, we write it on the right hand side. Again 39 is divided by 2 and remainder is 1 which is written below that. The process is continued till quotient comes 0. When it is 1, it is written as it on the right hand side and process ends here only. Then all these remainders are written in reverse order.

What we get ultimately that is 100 1111, is binary format of decimal number which is stored in 2 bytes or 16 bits.

The outermost left bit is significant bit used as a reserved bit and is not used for storing a number. It is exclusively used for denoting positive or negative number. 0 is placed in the reserved bit when number is positive and 1 is placed in the reserved bit when the number is negative.

What a millimeter is to length, bit is to memory. Bit is fusion of two words Binary Digit. A single bit… like a light switch button, reflects either of two different statuses. Either, on or off, Bit consisting 1 means bit is on and bit consisting 0 means bit is off.

So a single bit can be used to exhibit 2 different sets of information. Likewise two light switches provide 4 different statuses and similarly 2 bits can be used to store 4 different types of information. More the bits more variety of information…

In computers,

4 bits make 1 word, 8 bits make 1 byte,  1024 bytes make 1 kilo byte,  1024 kilo bytes make 1 Giga byte, 1024 Giga bytes make 1 Tera Byte….

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. please register free on Register / Login


1 comment
  1. […] To convert Decimal number into binary format just go on dividing number by 2 successively and finally you will get bit pattern of that number as shown in the video […]

Leave a Reply