Double quotes and single quotes in C

How to use quotes in C

inCYou may find yourself using double quotes in some cases and single quotes in other cases.

In some languages, there is no difference between the two. But in C language, there are differences, you will use one with the other as needed.

When can single quotes and double quotes be used?

Single quotes are used to identify a single character (charvalue):

char letter = 'a';

Double quotes are used to create string literals:

char *name = "Flavio";

Note that you can create a single-letter string literal:

char *letter = "a";

But remember, the string is composed of the characters of the string, plus a0The character at the end makes the single-letter string text occupy twice the space of a single character.

Download mine for freeC manual


More clang tutorials: