Multi-dimensional Arrays

 Multi-dimensional Arrays


Multi-dimensional arrays are arrays with more than one dimension. They allow you to store data in a tabular form or create complex data structures like matrices.



#include <stdio.h>


int main() {

    int matrix[3][3] = {{1, 2, 3},

                        {4, 5, 6},

                        {7, 8, 9}};


    printf("Matrix:\n");

    for (int i = 0; i < 3; i++) {

        for (int j = 0; j < 3; j++) {

            printf("%d ", matrix[i][j]);

        }

        printf("\n");

    }


    return 0;

}

No comments:

Post a Comment

The Importance of Cybersecurity in the Digital Age

 The Importance of Cybersecurity in the Digital Age Introduction: In today's digital age, where technology is deeply intertwined with ev...