William Entriken
William Entriken

Reputation: 39283

NSArray arrayWithObjects needs nil at the end, NSString stringWithFormat and NSLog() doesn't. Why?

NSArray arrayWithObjects needs nil at the end, NSString stringWithFormat and NSLog() doesn't. Why?

[NSArray arrayWithObjects:<#(id), ...#>, nil] 

[NSString stringWithFormat:<#(NSString *), ...#>]

NSLog(<#NSString *format, ...#>)

Upvotes: 0

Views: 547

Answers (1)

Wevah
Wevah

Reputation: 28242

Because -stringWithFormat: and NSLog can infer the number of arguments based on their format strings (the first argument). -arrayWithObjects: can't.

Upvotes: 4

Related Questions