Home>Topic List>How to get the length of an array in C language

How to get the length of an array in C language

There are two ways to get the length of an array in C language: use sizeof() operator: length = sizeof(arr) / sizeof(arr[0]); use macro: #define array_length(arr) (sizeof(arr) / sizeof(arr [0])). If you want to know more about array length, you can read the article below this topic.