Strings

It's time to learn how to declare strings and how C handles them.

We'll cover the following

I’ll be honest, C is slightly awkward for dealing with character strings, especially compared to languages like Python.

String is one of the most popular data types in programming.

A collection of characters grouped together forms a string.

Constant character strings are written inside double-quotation marks (line 5 below).

Strings are actually, under the hood, arrays of characters. Single character variables are declared using single-quotation marks (line 7 below).

String variables can be declared as indicated on line 8 below. The double square brackets signify an array. Just like arrays, we can access string elements through indexing.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy