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 double 
C :: print an int c 
C :: How to copy one string into another in C 
C :: apt-mark remove hold 
C :: set all pins as output for loop 
C :: 2d array in c 
C :: . Simulate MVT and MFT. 
C :: increment and decrement operator 
C :: c memcpy array 
C :: print only last 3 number float in c 
C :: algorithm for dequeue 
C :: 1000000000 
C :: fwrite c 
C :: fifo in c 
C :: declaration of string in c 
C :: C Syntax of goto Statement 
C :: c get pid 
C :: With which of the following can you run code without provisioning or managing servers and pay only for the compute time consumed (there is no charge when the code is not running)? 
C :: metw.cc 
C :: how to find adam number uasing loop in C 
C :: onvert a string into 2d string in c 
C :: C (GEM) 
C :: minimun number of moves in c 
C :: unigine 
C :: assembly lea instruction 
C :: C Why enums are used? 
C :: command line coursera 
C :: yt-project annotate_scale 
C :: or gmode inline image 
C :: c logarithm check if number is base 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =