October 2004
Beginner
408 pages
9h 24m
English
A character string is a type of array, each element containing a specific character and terminating with the \0 character. The code
char name[] = Marc";
requires 5 bytes of memory, since a single character in C requires 1 byte.
In Chapter 9, “Working with Pointers,” you saw that an array's name can also act as a pointer to that array's address. The following code works fine, demonstrating two different uses of the same name array (Figure 11.1):
char name[] = "Marc";
printf ("String: %s \nPointer: %p",
name, name);

The name example adds little ...
Read now
Unlock full access