fork download
  1. #include <stdio.h>
  2.  
  3. #define LENGTH(array) (sizeof(array) / sizeof(array[0]))
  4.  
  5. int main() {
  6. int array[] = {1, 2, 3, 4, 5};
  7. int length = LENGTH(array);
  8.  
  9. printf("数组长度为: %d\n", length);
  10.  
  11. return 0;
  12. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
数组长度为: 5