PROGRAM TO DETERMINE LENGTH OF STRING USING POINTERS

/*PROGRAM TO DETERMINE LENGTH OF STRING USING POINTERS*/
#include<stdio.h>
#include<conio.h>
void main()
{
char a[10],*p;
int i=0;
clrscr();
printf(“Enter any string: “);
gets(a);
p=a;
while(*p!=’\0′)
{
i++;
p++;
}
printf(“Length of given string is: %d”,i);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *