I need some help counting the rows and columns of a two dimensional array. It seems like I can\'t count columns?
#include
int main() {
char res
That's a problem of integer division!
int column = sizeof(result[0])/row;
should be
int column = 7 / 10;
and in integer division, 7/10==0
.
What you want to do is divide the length of one row, eg. sizeof(result[0])
by the size of one element of that row, eg. sizeof(result[0][0])
:
int column = sizeof(result[0])/sizeof(result[0][0]);