Skip to content

Instantly share code, notes, and snippets.

@544
Created April 17, 2011 17:49
Show Gist options
  • Save 544/924281 to your computer and use it in GitHub Desktop.
Save 544/924281 to your computer and use it in GitHub Desktop.
可変長引数のサンプル
// 可変長引数のサンプル
#import <stdarg.h>
@interface ExampleVaList : NSObject
- (void) doSomething:(NSString *) arg, ... NS_REQUIRES_NIL_TERMINATION;
@end
@implementation ExampleVaList
- (void) doSomething:(NSString *) arg, ... {
va_list valgList;
va_start(valgList, arg);
NSString * val;
while ((val = va_arg(valgList, NSString*)) != nil) {
NSLog(val,0);
}
va_end(valgList);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment