- Default value of variables at the time of declaration -

Posted by gotye on Stack Overflow See other posts from Stack Overflow or by gotye
Published on 2010-04-14T07:42:57Z Indexed on 2010/04/14 7:53 UTC
Read the original article Hit count: 312

Hey guys,

I was wondering what was the default values of variables before I intialize them ..

For example, if I do :

//myClass.h

BOOL myBOOL; // default value ?
NSArray *myArray; // default value ?
NSUInteger myInteger; // default value ?

Some more examples here :

//myClass.m
// myArray is not initialized, only declared in .h file

if ([myArray count] == 0) { // TRUE or FALSE ?

// do whatever

}

More generally, what is returned when I do :

[myObjectOnlyDeclaredAndNotInitialized myCustomFunction];

Thank you for your answers.

Gotye.

© Stack Overflow or respective owner

Related posts about declaration

Related posts about header-file