Computer Science, asked by gurteg3410, 1 year ago

C program to calculate the string length of a given string,using pointer

Answers

Answered by rahulsharma7387
2
#include<stdio.h>
int main()
{
char str[20], *ptr;
int i = 0;
printf("Enter Any string ");
gets(str);
ptr = str;
while (*ptr!= '\0')
{
i++;
ptr++;
}
printf("Length of String : %d", i);
return 0;
}

Similar questions