8.4.1 Accessing array elements using pointers

8.4.1 পইণ্টাৰ ব্যৱহাৰ কৰি এৰে উপাদানসমূহ প্ৰাপ্ত কৰা

Let us first see how we can access the elements of an array using pointers. We have already seen that when we declare an array, a certain amount of memory is allocated by the compiler. For example, an int array of size 5 will allocate 20 bytes (assuming int takes 4 bytes, 5×4=20).

আমি প্ৰথমে চাওঁ আহক আমি পইণ্টাৰ ব্যৱহাৰ কৰি এৰেএটাৰ উপাদানবোৰ কেনেদৰে প্ৰৱেশ কৰিব পাৰোঁ। আমি ইতিমধ্যে দেখিছোঁ যে যেতিয়া আমি এটা এৰে ঘোষণা কৰোঁ, কম্পাইলাৰৰ দ্বাৰা এক নিৰ্দিষ্ট পৰিমাণৰ মেম’ৰী আৱণ্টন কৰা হয়। উদাহৰণ স্বৰূপে, 5 আকাৰৰ এটা ইণ্ট এৰে20 বাইট আৱণ্টন কৰিব (ধৰি লওঁক ইণ্টে 4 বাইট, 5এক্স4=20 লয়)।

Have a look at the simple C program in Example 8.9. We have taken an int array of size 5 and we have initialized some values to the elements. We have then displayed the addresses of these array elements.

উদাহৰণ 8.9-ত সৰল চি প্ৰ’গ্ৰামটো চাওক। আমি ৫ আকাৰৰ এটা ইণ্ট এৰে লৈছো আৰু আমি উপাদানবোৰলৈ কিছুমান মান আৰম্ভ কৰিছো। আমি তেতিয়া এই এৰে উপাদানবোৰৰ ঠিকনাপ্ৰদৰ্শন কৰিছো।