Computer Science, asked by shriganeshbhanp5du3h, 10 months ago

Write a algorithm

to find length of string using pointer​

Answers

Answered by Nushrat109
7

Answer:

String length in C

1.int main() {char a [100]; into length

2.printf ("Enter a string to calculate its length\n"); gets (a);

3.length = strlen(a);

4.printf ("Length of the string = %d\n",length);

5.return 0;}

Explanation:

Hope it will help you

Answered by Agastya0606
3

Algorithm to find the length of string using pointer:-

  • First, we will declare a character string as int main() {char a [100]; into length
  • Then , we will display a message to the user asking him to enter a string as printf ("Enter a string to calculate its length\n"); gets (a);
  • Then we will use strlen function to find the length of the string as length = strlen(a);
  • Then we will display the length of the string as printf ("Length of the string = %d\n",length); return 0;}
  • The length of the string will be displayed on the screen after the execution of the program.

#SPJ3

Similar questions