6.3 ARRAY DECLARATION IN C

6.3 এৰে ঘোষণা চি

Every programming language supports arrays. The declaration and other syntax may vary a bit from one language to another. In C programming language, the array of Figure 6.1 can be declared as follows.

প্ৰতিটো প্ৰ’গ্ৰামিং ভাষাই এৰে সমৰ্থন কৰে। ঘোষণা আৰু অন্যান্য বাক্যবিন্যাস এটা ভাষাৰ পৰা আন এটা ভাষালৈ অলপ বেলেগ হ’ব পাৰে। চি প্ৰ’গ্ৰামিং ভাষাত, চিত্ৰ 6.1-ৰ এৰে নিম্নলিখিত ধৰণে ঘোষণা কৰিব পাৰি।

Here, num is the name of the array. This is also called the base address of the array. The declaration states that “num” is an integer type of array that can store seven elements at max. Base address is the address of the first element of an array. we will learn more about this in Chapter-8.

ইয়াত, সংখ্যা হৈছে এৰেৰ নাম। ইয়াক এৰেৰ আধাৰ ঠিকনা বুলিও কোৱা হয়। ঘোষণাটোত কোৱা হৈছে যে “সংখ্যা” হৈছে এক পূৰ্ণসংখ্যা প্ৰকাৰৰ এৰে যি সৰ্বাধিক সাতটা উপাদান সংৰক্ষণ কৰিব পাৰে। আধাৰ ঠিকনা হৈছে এৰেএটাৰ প্ৰথম উপাদানৰ ঠিকনা। আমি অধ্যায়-8-ত এই বিষয়ে অধিক শিকিম।

If we want to declare by assigning initial values to the elements, we may use the following declaration.

যদি আমি উপাদানবোৰক প্ৰাৰম্ভিক মূল্য নিৰ্ধাৰণ কৰি ঘোষণা কৰিব বিচাৰো, আমি নিম্নলিখিত ঘোষণাটো ব্যৱহাৰ কৰিব পাৰোঁ।

If we want to declare an array of size 17 that can store character type data, we can use the following statement.

যদি আমি আকাৰ 17 ৰ এটা এৰে ঘোষণা কৰিব বিচাৰো যি চৰিত্ৰৰ প্ৰকাৰৰ ডাটা সংৰক্ষণ কৰিব পাৰে, আমি নিম্নলিখিত বিবৃতিটো ব্যৱহাৰ কৰিব পাৰোঁ।

Here, the name of the array is “state” and every element of the array can store any one character. As a whole, the whole array can store seventeen characters.

ইয়াত, এৰেৰ নাম হৈছে “অৱস্থা” আৰু এৰেৰ প্ৰতিটো উপাদানে যিকোনো এটা বৰ্ণ সংৰক্ষণ কৰিব পাৰে। সামগ্ৰিকভাৱে, গোটেই এৰেটোৱে সতেৰটা বৰ্ণ সংৰক্ষণ কৰিব পাৰে।

Whenever we want to declare a character type array and assign some initial values, we may declare in the following way.

যেতিয়াই আমি এটা বৰ্ণপ্ৰকাৰ ৰস ঘোষণা কৰিব বিচাৰো আৰু কিছুমান প্ৰাৰম্ভিক মান আৱণ্টন কৰিব বিচাৰো, আমি নিম্নলিখিত ধৰণে ঘোষণা কৰিব পাৰোঁ।

Array in C programming can be declared in other ways as well. Let us not doiscuss this now.