Read in Hindi
Read in English

We have learned very much about C/C++ programming and now you are ready to write big programs using this tutorial. Now we will learn pointers in easy way which is considered most difficult in C/C++. I will try to present it in easy way but feel free to leave comment if you have any problem.

It is important to know about Memory before learning Pointer so today we will learn how memory in organized in computer. You know that computer or any electronic device understand language of 0 and 1 only. Today we will understand it in detail. Memory in any device can be seen as an array as shown below.
110100011 0 . . .

Memory looks like an Array shown above, each of the position can store either 0 or 1. Each location is called a bit. 1 bit can store either 0 or 1. In magnetic memory this is represented by magnetic field. If direction of magnetic field is clockwise then computer reads it as 0 otherwise reads it as 1 if direction is anticlockwise. Computer never reads 1 bit a time, it always reads 8 bits together which is called a byte. Hence computer reads memory as shown below.
1101000110011101001010011111100110000011 00100110 . . .

If computer reads 1st address of memory(array) shown below then it will get 11010001. value at 2nd address will read as 10011101 etc. When Computer reads 1st address of Memory, it will get 1st byte(8 bits), 2nd byte at 2nd address... If it is needed to get value of 3rd bit inside 1st byte then it have to read whole 1st byte 1st then get 3rd bit from that byte. Directly 3rd bit can not be read. In summary Computer has byte level addressing of memory. Each byte have an address but bit do not have direct address.

In next topic we will see how do we store so many variables in the memory then we will learn about pointer. Before going to next topic, learn how to convert number in decimal representation to binary representation and how to add 2 binary numbers.
अब तक हमने C/C++ programming के बारे में बहुत कुछ जान लिया है और इस hindi tutorial के द्वारा आप बड़े बड़े program लिखने के लिए भी Ready हैं. अब हम pointer को सरल तरीके से सीखेंगे जिसे C/C++ में सबसे कठिन माना जाता हैं. इसे सरल तरीके से पेश करने कि कोशिश रहेगी, फिर भी समझने में दिक्कत हो तो नीचे comment करें.

Pointer समझने से पहले Memory के बारे में जानना जरूरी है इसलिए आज हम Memory Structure को समझेंगे. आप में से बहुत से लोगो को पता होगा कि computer या कोई भी electronic device जैसे calculator, micro processor, mobile phone सभी सिर्फ 0 और 1 की भाषा समझते हैं, आज हम इसे detail में समझते हैं. किसी भी device की Memory को हम एक बहुत बड़ी array की तरह देख सकते हैं. जैसा कि नीचे चित्र में दिखाया गया है.
110100011 0 . . .

Memory ऊपर दिखाई गयी Array की तरह दिखती है जिसकी हर एक position पर या तो 0 store हो सकता है या 1. हर एक position को एक bit कहते हैं. 1 bit में या तो 0 store होगा या 1. Magnetic memory में इस एक bit को magnetic field की direction के द्वारा represent किया जाता है. अगर direction clockwise है तो इसे computer 0 read करता है, aniclockwise है तो 1. Computer कभी इस एक bit को अकेले read या write नहीं करता. वह हमेशा 8 bits को एक साथ पढता है. इस 8 bit को 1 byte कहते हैं. इसलिए computer Memory को नीचे दिखाए गए चित्र जैसा पढता है.

1101000110011101001010011111100110000011 00100110 . . .

अगर Computer ऊपर दिखाई गयी memory(array) का पहला address पढ़े तो उसे मिलेगा 11010001. इसी तरह दूसरे address पर 10011101 etc. Computer किसी भी Memory का पहला address पढ़े तो उसे पहली byte(8 bits) मिलेगी, दूसरे address पर दूसरी byte,... अगर पहली byte के अंदर की तीसरी bit पढनी है तो पहले उसे पहली byte पढनी पड़ेगी उसके बाद उस byte से तीसरी bit. directly पहली byte की तीसरी bit नहीं पढ़ सकते, क्योंकि पहला address पढ़ेगा तो पहली byte (पहली 8 bits) मिल जाएँगी. कहने का मतलब यह है कि Computer में byte level addressing होती है. हर byte का एक address होता है, पर byte के अंदर bit का direct address नहीं होता.

आज के लिए इतना ही. अगली बार हम ये देखेंगे कि इस Memory में इतने variable store कैसे होते हैं उसके बाद pointer सीखेंगे. अगला लेख पढ़ने से पहले Binary to Decimal Conversion सीख लें और दो Binary number को जोड़ना भी सीख लें.