Because static is only initialized once. Despite the fact that the variable is inside the function, its storage time makes up the entire program. It is initialized once and retains its value between function calls.
This code you posted is exactly the same conceptual as:
NSArray *motivations = nil;
+ (NSArray *)motivations {
if (!motivations) {
motivations = [[NSArray alloc] initWithObjects:@"Greed", @"Revenge",
@"Bloodlust", @"Nihilism", @"Insanity", nil];
}
return motivations;
}
( motivations). , , , , .
ISO C99 (, , C, ):
( ).