Wednesday, 21 December 2016

Length Of String Using Pointer - Simplest Method

#include<stdio.h>
main()
{
int num,i,j=0;
char n[100],ch,*p;
printf("Enter Any String Max 100 Char");
gets(n);
p=n;
for(i=0;*(p+i)!='\0';i++)
{
j++;
}
printf("The Lenght Of String Is: %d",j);
}

No comments:

Post a Comment