Skip to content

Instantly share code, notes, and snippets.

@gonecoding
Created August 11, 2011 09:33
Show Gist options
  • Save gonecoding/1139278 to your computer and use it in GitHub Desktop.
Save gonecoding/1139278 to your computer and use it in GitHub Desktop.
Example of an Objective-C method with a variable list of arguments (va_list)
- (void)methodName:(NSObject*)firstObject, ... NS_REQUIRES_NIL_TERMINATION;
- (void)methodName:(NSObject*)firstObject, ...
{
va_list args;
va_start( args, firstObject );
for( NSObject* arg = firstObject; arg != nil; arg = va_arg( args, NSObject*) )
{
// do something using 'arg' here
}
va_end( args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment