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 my_strlen(char *str) {
2 int i = -1;
3
4 while (str && str[++i]);
5 return (i);
6}