I\'m coming from an Objective-C background and am trying to expand my knowledge in C. One thing has me confused, however, and that\'s the difference between pointers in C and O
The question is - are your strings const or not?
The first example would probably work.
Even in non-objective C compilers, literal strings can be placed in const memory via linker / compiler options.
On this line: stringPointer = &string; You are copying the address of the pointer into the string poitner. Clearly incompatible.
And on this line:
*stringPointer = @"Chocolate milkshake";
You are trying to write a string into the pointer (the pointer is a 4 byte address). Not a good idea to copy a whole string on top of it.