Char as instance variable


After i reached chapter 19 i went back to the beginning of the book and started playing around a litte bit in order get practise.

I created a class Person and tried to define a char instance variable like that:

In main.m i filled the variable like that:

I’m not sure if that’s right, because i get a warning, saying:


char only holds one character (and if you want unicode characters, you should use unichar).

So when you call setName: it would look like this:

[person setName:'p']; (Note the single-quotes)


So i must use always single-quotes when setting a string variable?
What would be the proper type for a string (multiple chars)?


If you want a string of C chars, the type is char *. You can tackle that after chapter 34!