1int prices[5] = { 1, 2, 3, 4, 5 };
2
3int size = sizeof prices / sizeof prices[0];
4
5printf("%u", size); /* 5 */
1//I suggest using strlen (of #include<string.h>)
2//if you want only the size of the occupied index
3
4int prices[5] = { 1, 2, 3, 4, 5 };
5int size = strlen((char*)prices); // convert it to string
6printf("%d", size+1); // Just add 1 that's it
1//I suggest using strlen (of #include<string.h>)
2//if you want only the size of the occupied index
3
4int prices[5] = { 1, 2, 3, 4, 5 };
5int size = strlen(prices);
6printf("%d", size); // 5