Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

exmorpheus

macrumors newbie
Original poster
I noticed some array methods like initWithObjects or arrayWithObjects allow you to keep adding arguments until you pass a null argument. So I'm wondering how I would make something similar to that. I looked at the header file in which arrayWithObjects was declared and saw this:

Code:
- (void)arrayWithObjects:(id *)firstObject, ... NS_REQUIRES_NIL_TERMINATION;

I was wondering if I could do the same with my own methods and if so, how do I call the other arguments?
 
Use a va_list. It's how functions like printf (and the one you posted, as far as I can tell) work.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.