Thursday, 27 October 2016

LENGTH OF STRING USING POINTER


#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char a[100],i,*p,length=0;
printf("enter the string"); 
gets(a);
p=&a[0];

while(*p!='\0')
{
length++;
p++;
}

printf("length of string=%d",length);
getch();
}

No comments:

Post a Comment