Skip to content

Commit de5bf48

Browse files
authored
Create 7.c
1 parent a9d1675 commit de5bf48

File tree

1 file changed

+21
-0
lines changed
  • Special Programs

1 file changed

+21
-0
lines changed

Special Programs/7.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//Write a C function to find the length of string using pointers.
2+
3+
#include<stdio.h>
4+
int length(char *s)
5+
{
6+
int i=0;
7+
while(*(s+i)!='\0')
8+
{
9+
i++;
10+
}
11+
return i;
12+
}
13+
void main()
14+
{
15+
char s[100];
16+
int len;
17+
puts("Enter the string ");
18+
gets(s);
19+
len=length(s);
20+
printf("Length of String is : %d",len);
21+
}

0 commit comments

Comments
 (0)