Find the length of the string using Library function

0
Output

What this program does

The program finds and displays the length of a string. It stores a word (for example, river) and uses a built-in function to count how many characters the word contains, excluding the special end-of-string marker that the language uses internally.

Key points

  • The function returns the number of visible characters (letters, digits, punctuation) in the string.
  • The terminating null character used internally is not counted.
  • For the example word river, the returned length is 5.

Note about compilers

Some older compilers (like Turbo C++) use a function to pause the screen after output; modern compilers (GCC, Clang, MSVC) do not need that and prefer returning from main. The logic for measuring the string length remains the same across compilers.

Short summary: The program calculates the number of characters in a stored word (excluding the internal terminator) and prints that number.

Tags

Post a Comment

0Comments

Post a Comment (0)