Strings

Learn how to declare strings and how C handles them.

We'll cover the following...

String is one of the most popular data types in programming. To be honest, it’s slightly awkward dealing with character strings in C, especially when compared to languages like Python.

A collection of characters grouped together forms a string. We have seen earlier how constant character strings are written inside double-quotation marks as opposed to character constants that are declared using single-quotation marks.

In C, a string is actually, under the hood, an array of characters. String variables can be declared as indicated on line 5 below. The double square brackets signify an array. Just like arrays, we can access string elements through indexing.