# মাল্টি ডাইমেনশনাল অ্যারে

মাল্টি ডাইমেনশনাল অ্যারে নামটিই বলে দেয় যে এই অ্যারেগুলোতে একের অধিক ডাইমেনশন বা ইনডেক্সিং আছে। আমাদের সুবিধার জন্য আমরা টু-ডাইমেনশনাল অ্যারে নিয়ে কাজ করব এই অধ্যায়ে। অ্যারেতে এর চাইতে বেশি ডিরেকশনও থাকতে পারে, কিন্তু সেগুলো একটু অ্যাডভান্সড লেভেলের কাজ হয়ে যায়। টু-ডাইমেনশনাল অ্যারেকে আমরা এরকম টেবল বা ম্যাট্রিক্স আকারেও দেখাতে পারি। এবং স্বাভাবিকভাবেই এই অ্যারের ইনডেক্সিংও শুরু হয় `0,0` থেকে। নিচের টেবলটি একটি টু-ডাইমেনশনাল অ্যারের রিপ্রেজেন্টেশন হিসেবে ধরা যায়।

| a \[0,0] | a\[0,1]  | a\[0,2]  |
| -------- | -------- | -------- |
| a \[1,0] | a \[1,1] | a \[1,2] |
| a \[2,0] | a \[2,1] | a \[2,2] |
| a \[3,0] | a \[3,1] | a \[3,2] |

এবার আসুন আমরা দেখি এধরনের অ্যারে নিয়ে আমরা কিভাবে কাজ করব। এই অ্যারে ডিক্লেয়ার করতে হয় সাধারণ অ্যারের মতই। আসুন দেখে নিই কিভাবে মাল্টি ডাইমেনশনাল অ্যারে ডিক্লেয়ার ও ভ্যালু অ্যাসাইন করতে হয়।

```c
int a[3][4] = {
 {0, 1, 2, 3} ,   // values for first row, index 0
 {4, 5, 6, 7} ,   // values for second row, index 1
 {8, 9, 10, 11}   // values for third row, index 2
};


int b[3][4] = {0,1,2,3,4,5,6,7,8,9,10,11};  // this works too
```

উপরের কোডগুলোতে আমরা দেখলাম কিভাবে মাল্টি ডাইমেনশনাল অ্যারে বানাতে হয়। এই অ্যারে অ্যাকসেস করার নিয়ম ওয়ান ডাইমেনশনাল অ্যারের মতই। আসুন দেখি for লুপ ব্যবহার করে কিভাবে আমরা এই ধরনের অ্যারে অ্যাকসেস করতে পারি।

```c
#include <stdio.h>

int main (void)
{

int a[3][4] = {
 {0, 1, 2, 3} ,   // values for first row, index 0
 {4, 5, 6, 7} ,   // values for second row, index 1
 {8, 9, 10, 11}   // values for third row, index 2
};
int i, j;

// output each array element's value
for ( i = 0; i < 3; i++ )
{
    for ( j = 0; j < 4; j++ )
    {
        printf("a[%d][%d] = %d", i,j, a[i][j] );
    }

    printf("\n");
}
   return 0;
}
```

এই উদাহরণে আমরা দেখতে পাচ্ছি আমরা কিভাবে `for` লুপ ব্যবহার করে আমরা টু-ডাইমেনশনাল অ্যারে অ্যাকসেস করছি।


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://c.howtocode.dev/array_intro/multy_dimen_array.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
