[C] 陣列:元素個數、列數、行數

#include <stdio.h>
#include <stdlib.h>
int main() {
   // 成本邊線陣列: 邊線數 = [8]    {from, to, weight}
   int edge[8][3] = { { 1, 2, 2 },
                      { 2, 4, 3 },
                      { 1, 4, 4 },
                      { 3, 5, 5 },
                      { 2, 5, 6 },
                      { 2, 3, 8 },
                      { 3, 4, 10 },
                      { 4, 5, 15 } };
                     
   int a, b, c;
   // 元素個數 a=24    列數 b=8    行數 c=3
   a = sizeof(edge)/sizeof(edge[0][0]);
   b = sizeof(edge)/sizeof(edge[0]);
   c = a/b;
 
   printf("%d \n", a);
   printf("%d \n", b);
   printf("%d \n", c);
 
   system("pause");
   return 0;
}