how to get from string value to 2d array in c code example

Example 1: 2d array of strings in c

language[0] => "Java";
language[1] => "Python";
language[2] => "C++";
language[3] => "HTML";
language[4] => "SQL";

Example 2: 2d array of strings in c

// it is valid
char language[ ][10] = {"Java", "Python", "C++", "HTML", "SQL"};

Example 3: how to get input in 2d array in c

#include <stdio.h>

int main(){

    printf("Enter the number of columns");
    int i; 
    scanf("%d", &i);
    printf("Enter the number of rows");
    int y; 
    scanf("%d", &y);

    int r[i][y];
    int a;
    int b;

        for (a=0; a<i; a++){
            for (b=0; b<y; b++){
    scanf("%d",&r[a][b]);
        }
    }
}

Tags:

C Example