-3

In objective c, when creating objects, why do we need to use *? For example, we are creating

NSString *string =@"i ma string";

In the above code why do we need to use *string

Can anyone explain please?

Thanks in advance.

muttley91
  • 12,278
  • 33
  • 106
  • 160
Siva
  • 181
  • 1
  • 1
  • 6

2 Answers2

0

Objective-C mandates that you access objects via pointers, such that they're created on the heap and never on the stack

JuJoDi
  • 14,627
  • 23
  • 80
  • 126
0

* means that it is pointer to object, not the actual object

AlieN
  • 555
  • 2
  • 16
  • what is the difference between heap memory and stack memory in objective C, AlieN can please explain if it is possible – Siva Apr 13 '14 at 14:44
  • @Siva http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.html – AlieN Apr 13 '14 at 14:48