(Note: Any other correct logic shall be considered).
#include<stdio.h>
#include<conio.h>
void main() {
char ar[50];
char *s;
int l=0;
clrscr();
printf("enter a string");
scanf("%s",ar);
s=ar;
while(*s!='\0'){
l++;
s++;
}
printf("Length of th string is %d",l);
getch();
}
0 Comments