Monday, June 25, 2018

Program to find the length of a string without using "strlen()" - DS (C Program)

#include<stdio.h>
void main()
{
char n[]="hello";
char *p=&n[0];
int len=0;
clrscr();
while(*p!='\0')
{       if(*p=='\0')
break;
len++;
p++;
}
printf("Length is : %d",len);
getch();
}

No comments:

Post a Comment