C言語の配列|宣言・初期化・二次元配列

C言語の配列|宣言・初期化・二次元配列 (c言語 配列): practical C programming guide with runnable standard C17 source code that you can edit, compile, and test directly in your browser.

1. C言語の配列|宣言・初期化・二次元配列

This guide covers c言語 配列 in standard C (C17) with clear syntax rules and practical compiler patterns. You can run and modify the complete C program below in the online GCC compiler without installing a local IDE.

2. c言語 配列 — Syntax & Best Practices

When working with c言語 配列, always compile with -Wall -Wextra, initialize variables before reading them, and verify input/boundary conditions to prevent undefined behavior.

#include <stdio.h>

int main(void) {
    int m[2][3] = {{1, 2, 3}, {4, 5, 6}};
    for (int r = 0; r < 2; ++r) {
        for (int c = 0; c < 3; ++c) {
            printf("%d ", m[r][c]);
        }
        printf("\n");
    }
    return 0;
}