Char as instance variable


#1

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:


#2

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)


#3

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


#4

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