8

Possible Duplicate:
default value of BOOL in Objective-C?

If I declare a BOOL property in a class, what will be its default value? If I don't set a value for the variable when creating an object of the class, is it always NO or will it return YES in any case?

Community
  • 1
  • 1
Arock
  • 397
  • 5
  • 17
  • See also: http://stackoverflow.com/questions/4528098/is-there-automatic-initialization-for-attributes, http://stackoverflow.com/questions/990817/objective-c-ints-always-initialized-to-0 – jscs Jan 08 '13 at 06:42
  • definitely not a duplicate question either: initializing property and local variable are two different things. Good job shutting down a good question. – timbre timbre Jan 20 '20 at 16:31

1 Answers1

18

It'll be NO. It'll be initialized to FALSE/NO, Because when you declare it without any value, it'll be initialized to zero, zero means FALSE or NO

Midhun MP
  • 103,496
  • 31
  • 153
  • 200