October 2004
Beginner
408 pages
9h 24m
English
A more complex version of characters is the character string. Unlike strings you might have used in other programming languages, character strings are a sequence of individual characters.
The easiest way to create a character string is
char name[] = "David Brent";
This will create a variable called name, which contains the string David Brent. However, because character strings must end with the \0 character (which is the NULL character), name actually contains 12 characters.
Chapter 11 will discuss strings in all their glory. In the meantime, let's quickly add and print a character string in our working example.
1. | Open var4.c (Script 2.4) in your text editor or IDE. |
2. | After declaring ... |
Read now
Unlock full access