6.2 INTRODUCTION

৬.২ পৰিচয়

Array is a collection of similar data items where elements are stored in contiguous memory locations in our computer. Each data item of an array is typically called an element and each element has a specific memory location and this can be accessed by its relative position in the array. This relative position can also be referred as the index of the element. This can be shown using Figure 6.1.

এৰে হৈছে একে ধৰণৰ ডাটা আইটেমৰ এক সংগ্ৰহ য’ত উপাদানবোৰ আমাৰ কম্পিউটাৰত সংলগ্ন মেম’ৰী অৱস্থানত সংৰক্ষণ কৰা হয়। এৰে এটাৰ প্ৰতিটো ডাটা আইটেমক সাধাৰণতে এটা উপাদান বুলি কোৱা হয় আৰু প্ৰতিটো উপাদানৰ এটা নিৰ্দিষ্ট মেম’ৰী অৱস্থান থাকে আৰু ইয়াক এৰেত ইয়াৰ আপেক্ষিক স্থিতিৰ দ্বাৰা প্ৰৱেশ কৰিব পাৰি। এই আপেক্ষিক স্থিতিটো উপাদানটোৰ সূচী বুলিও ক’ব পাৰি। ইয়াক চিত্ৰ 6.1 ব্যৱহাৰ কৰি দেখুৱাব পাৰি।

The figure shows an integer type of array, meaning that the array is a collection of all integer of elements. We may also say that the array can store only integer type of data. The array shown in the figure stores integers 24, 87, 97, 99, 77, 19 and 17.

চিত্ৰটোৱে এক ইণ্টেগাৰ প্ৰকাৰৰ এৰে দেখুৱায়, অৰ্থাৎ এৰে হৈছে সকলো ইণ্টেগাৰৰ উপাদানৰ সংগ্ৰহ। আমি এইটোও ক’ব পাৰোঁ যে এৰেটোৱে কেৱল ইণ্টেগাৰ প্ৰকাৰৰ ডাটা সংৰক্ষণ কৰিব পাৰে। চিত্ৰটোত দেখুওৱা এৰেটোৱে 24, 87, 97, 99, 77, 19 আৰু 17 অন্তৰ্নিহত কৰে।

(i) The size of an array in a number that says how many elements we can store in it at a time (maximum)

(i) এটা সংখ্যাত এটা এৰেৰ আকাৰ য’ত কোৱা হয় যে আমি ইয়াত এটা সময়ত কিমান টা উপাদান সংৰক্ষণ কৰিব পাৰোঁ (সৰ্বাধিক)

(ii) This is also called the capacity of the array.

(আইআই) ইয়াক এৰেৰ ক্ষমতা বুলিও কোৱা হয়।

 (iii) However, it may not store any element at all.

 (তৃতীয়) অৱশ্যে, ই কোনো উপাদান একেবাৰে সংৰক্ষণ নকৰিব পাৰে।

The elements in an array are stored one after another and they can be accessed by specifying their relative positions or indices. The index of the first element in an array is 0 by default. The index of the second element is I and so on. The index of the last element is the size of the array minus 1.

এৰে এটাত থকা উপাদানবোৰ এটাৰ পিছত এটাকৈ সংৰক্ষণ কৰা হয় আৰু সেইবোৰৰ আপেক্ষিক স্থিতি বা সূচক নিৰ্দিষ্ট কৰি প্ৰৱেশ কৰিব পাৰি। এৰে এটাত প্ৰথম উপাদানৰ সূচক ডিফল্টভাৱে 0 হয়। দ্বিতীয় উপাদানটোৰ সূচী হৈছে মই ইত্যাদি। অন্তিম উপাদানটোৰ সূচী হৈছে এৰে বিয়োগ 1-ৰ আকাৰ।

In Figure 6.1, the size of the array is 7. This at a time means we can not store more than 7 elements in it. The first element in the array is 24 and its index is 0. The last element in the array is 17 and its index is 7-1-6.

চিত্ৰ 6.1-ত, এৰেৰ আকাৰ 7। এটা সময়ত ইয়াৰ অৰ্থ হৈছে আমি ইয়াত ৭ টাতকৈ অধিক উপাদান সংৰক্ষণ কৰিব নোৱাৰো। এৰেৰ প্ৰথম উপাদানটো হৈছে 24 আৰু ইয়াৰ সূচক হৈছে 0। এৰেৰ অন্তিম উপাদানহৈছে 17 আৰু ইয়াৰ সূচক হৈছে 7-1-6।