C
c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>
int calculateLength(char*);
int main()
{
char str1[25];
int i;
printf("\n\n pointer: calculate the length of the string :\n");
printf("\n_______________________________\n");
printf(" input a string :");
fgets(str1,sizeof(str1),stdin);
i=calculateLength(str1);
printf("The length of the given string %s is : %d",str1,i-1);printf("\n\n");
}
int calculateLength(char*ch)
//ch=base adress of array strl (&strl[0])
{
int ctr=0;
while(*ch!='\0')
{
ctr++;
ch++;
}
return ctr;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run