size of an array c
snippet in c

size of an array c

user2703

int a[20];
int length;
length = sizeof(a) / sizeof(int);

array length c

user8403

int prices[5] = { 1, 2, 3, 4, 5 };

int size = sizeof prices / sizeof prices[0];

printf("%u", size); /* 5 */

get length of array in c

user140

int a[17];
size_t n = sizeof(a)/sizeof(a[0]);