Question: Hi sorry I've been stuck on this code for a while and both seem to work I just don't really understand the differences. 

```
struct faveThings{

  const char *favFood; 
  const char *faveFriend;

};

struct dog{

 const char name[20];
 const char breed[20];
 int height;
 int weight;

 struct faveThings dogFaves;

};

```

I can completely understand the dog struct the use of 'char name[20]' makes complete sense to me. But with faveThings I struggle with 'char \*favFood', I get that this is a pointer, but how can this hold a string if its just a char? Should it not be an array of chars?

```
const char *favFood[20];

```

Thanks for any help i've been banging my head against the wall for hours trying to find the difference.

Answer: 
You're right that `const char *favFood;` does point to a single `char`, but it is understood that there will be a block of memory containing consecutive `char`s, and that pointer points to the first one. So the code can use that pointer to access all of the `char`s in the block.

The code that uses `favFood` will also involve performing a memory allocation, filling up that memory with chars (and a null terminator), and seeing `favFood` to point into that allocation.

`const char *favFood[20];` would be an array of 20 pointers.
Below is an array of constant characters. It actually contains five elements, because the C language adds a '\0' at the end of the string delimited by the `"` symbols. In C, an array object, such as `MEAT` is actually a pointer to the first element of the array, so MEAT is actually a memory address not the entire array of characters!

```
const char[] MEAT = "Meat";

```

Below is a pointer to a `const char`. The `*` symbol tells you that it is a pointer. (It doesn't matter if you put the star by the type being pointed to or by the name of the variable. This can be confusing, so I usually keep the type information together and have the name on its own, but I believe this is not the most usual convention.) The `favFood` variable is initialised with the address of the first character in the `MEAT` array. (Remember that `MEAT` is a memory address, so this is setting one memory address to equal another.)

```
const char* favFood = MEAT;

```

At some point in the future, your animal may suddenly decide that it no longer likes meat and now it actually prefers biscuits (more likely for a cat to change its mind than a dog, I know, but this is just an example).

```
const char BISCUITS[] = "Biscuits";

/* Some code is done here, until you find... */

favFood = BISCUITS;

```

Now, both `MEAT` and `BISCUITS` are constant, which means you cannot change them, but `favFood` is not itself constant but points to a constant string (the first character in the string anyway), so you can change it!

You can also have non-constant strings:

```
char nameAndFaveFood[50];
sprintf(nameAndFaveFood, "%.26s likes %.9s best.", name, favFood);

```

... but make sure you don't copy more characters - including the terminating '\0' null character - than you have allocated space, in this case 49 characters and a terminator. This is why the `sprint` function has precision specifiers to limit the length of the sub-strings.

And you can have constant pointers to changeable memory.

```
char* const LIKES_FOOD = &nameAndFaveFood[27];

```

Note that the `LIKES_FOOD` object is initialised to point part way through the `nameAndFaveFood` array. It will always point at that address. You can call the routine in the previous code block with different `name` and `favFood` parameters, but `LIKES_FOOD` will always point to the 28th character in the `nameAndFaveFood` array.