Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to find the number of a known integer array in C language
How to find the number of a known integer array in C language
array size sizeof(arr) divided by sizeof(int)

for example:

# include <; stdio.h>

main( ){

int x[1];

int y[3][5];

printf("x elem number: %d\n", sizeof(x)/sizeof(int));

printf("y elem number: %d\n", sizeof(y)/sizeof(int));

return ;

}

de:

xelem number: 1

yelem number: 15.