-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointer1.c
More file actions
31 lines (29 loc) · 713 Bytes
/
Copy pathpointer1.c
File metadata and controls
31 lines (29 loc) · 713 Bytes
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
27
28
29
30
31
/*-------------------------------------------------------------------------------------------------------------------------------
pointer1.c
Function program in C to find the length of a string pointed by a memory location
DIVYA RAJ K
11-11-2018
---------------------------------------------------------------------------------------------------------------------------------*/
#include<stdio.h>
#include<stdlib.h>
int fnStrlen(char *S);
main()
{
int len;
char *S;
S=(char*)malloc(60);
system("clear");
printf("Enter a string whose length has to be found: ");
scanf("%s",S);
len=fnStrlen(S);
printf("\nLength=%d",len);
}
int fnStrlen(char *S)
{
int i=0;
while(*(S+i)!='\0')
{
i++;
}
return i;
}