C Exercises: Calculate the length of the string
10. String Length Using Pointer
Write a program in C to calculate the length of a string using a pointer.
Visual Presentation:

Sample Solution:
C Code:
Sample Output:
Pointer : Calculate the length of the string : --------------------------------------------------- Input a string : w3resource The length of the given string w3resource is : 10
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C program to calculate the length of a string using pointer arithmetic without using strlen().
- Write a C program to determine the length of a string recursively by advancing a pointer.
- Write a C program to compute the length of a string and then compare it with a user-specified value.
- Write a C program to find the string length and then reverse the string using pointer manipulation.
C Programming Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a program in C to find the largest element using Dynamic Memory Allocation.
Next: Write a program in C to swap elements using call by reference.
What is the difficulty level of this exercise?
Based on 272 votes, average difficulty level of this exercise is Easy
.
Test your Programming skills with w3resource's quiz.