c 2d array dimensions
int array[2][5];
int rows;
int cols;
cols = sizeof(array[0]) / sizeof(int);
rows = (sizeof(array) / sizeof(int))/cols;
printf("rows: %d\n",rows);
printf("cols: %d",cols);
c 2d array dimensions
int array[2][5];
int rows;
int cols;
cols = sizeof(array[0]) / sizeof(int);
rows = (sizeof(array) / sizeof(int))/cols;
printf("rows: %d\n",rows);
printf("cols: %d",cols);
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]);
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us