1#include <stdio.h>
2#include <string.h>
3int main()
4{
5 char a[20]="Program";
6 char b[20]={'P','r','o','g','r','a','m','\0'};
7
8 // using the %zu format specifier to print size_t
9 printf("Length of string a = %zu \n",strlen(a));
10 printf("Length of string b = %zu \n",strlen(b));
11
12 return 0;
13}
1int prices[5] = { 1, 2, 3, 4, 5 };
2
3int size = sizeof prices / sizeof prices[0];
4
5printf("%u", size); /* 5 */
1int a[]= { 1, 2, 3, 4, 5, 6, 7 };
2int length = sizeof(a) / sizeof(a[0]); //return 7