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
It's much more convenient (and less error prone) to use an array length macro:
#include #define LEN(arr) ((int) (sizeof (arr) / sizeof (arr)[0])) int main(void) { char result[10][7]; printf("Number of rows: %d\n", LEN(result)); printf("Number of columns: %d\n", LEN(result[0])); return 0; }