Search
 
SCRIPT & CODE EXAMPLE
 

C

print 2d array in c

// most of the time I forget that there should be matrix[i][j], not matrix[i]
#include <stdio.h>
// Abdullah Miraz
int main(){
    int i, j;

    int matrix[2][3] = {{2,3,4,5}, {7,8,9,1}};
    for(i=0;i< 2 ; i++){
        for(j=0;j<3;j++){
            printf("%d ", matrix[i][j]);
        }
    }
}
Comment

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("
");
    }

    return 0;
}
Comment

print 2d array

2-D Vectors


vector<vector<int>> vect;

for (int i = 0; i < vect.size(); i++)
    {
        for (int j = 0; j < vect[i].size(); j++)
        {
            cout << vect[i][j] << " ";
        }   
        cout << endl;
    }
Comment

PREVIOUS NEXT
Code Example
C :: c static 
C :: Calculator_C 
C :: arduino client disconnect 
C :: postgres random select 
C :: how to add two numbers in c programming 
C :: C percentage program 
C :: how to get add to number C 
C :: 0/1 knapsack problem in c 
C :: lldb set breakpoint function name 
C :: create empty vector in rust 
C :: divide and conquer program in c 
C :: %d in c 
C :: mutex c 
C :: insertion sort c 
C :: Area of a Circle in C Programming 
C :: Counting Sort C 
C :: 2 bytes integer c 
C :: sleep function in c 
C :: print a part of string c 
C :: loading builder in flutter 
C :: bash get load average 
C :: fibonacci series in c 
C :: addition of matrix 
C :: c median of an array 
C :: imprimir matriz 
C :: pointer arithmetic on Arrray in c 
C :: how to check the word is present in given char array in c 
C :: struct in struct 
C :: what is the last character of a string in c 
C :: c get pid 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =