find length of a string in c

Last Updated Nov 20, 2015, 07:00:14 PM





What is a string?

Strings in C programming can be represented as an of characters. You can think of a string as your name. However, in C strings always end with a string null character.

The null character is represented by another escape sequence, \0. C programming, has built-in string handling which allows us to use the string constants these string constants are also called as literals

If you create strings using double quotes, C will automatically create an array of characters for us which will also contain a terminator escape sequence \0. For example, let us see a sample string declaration.

Let us see how to find length of a string in c

To better understand this concept we recommand you to learn about strings in c

Output
Length of the string is : 9
Try It Now

Other string examples you might want to learn

Concatenate two strings in c

Remove characters in string except alphabets in c

Find number of vowels consonants and white spaces string in c

Copy string without using strcpy in c

Strings in C