Programing In C And C++
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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment