Answers for "C print 2D array"

6

matrix c declaration

int disp[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};
Posted by: Guest on March-18-2020
2

double array in c

int disp[2][4] = {
    {10, 11, 12, 13},
    {14, 15, 16, 17}
};
Posted by: Guest on June-21-2020
0

C print 2D array

#include <stdio.h>

#define MAX 10

int main()
{
    char grid[MAX][MAX];
    int i,j,row,col;

    printf("Please enter your grid size: ");
    scanf("%d %d", &row, &col);


    for (i = 0; i < row; i++) {
        for (j = 0; j < col; j++) {
            grid[i][j] = '.';
            printf("%c ", grid[i][j]);
        }
        printf("\n");
    }

    return 0;
}
Posted by: Guest on April-16-2021

Browse Popular Code Answers by Language