zombie45
zombie's dev story
zombie45

공지사항

  • 분류 전체보기
    • iPhone
    • Study

인기 글

최근 댓글

최근 글

티스토리

반응형

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록
  • 글쓰기
전체 방문자
오늘
어제

태그

  • l10nization
  • 오블완
  • android_key_hash
  • flutter_localizations
  • intl
  • nextFocus
  • Nodejs node express expressjs
  • Box2d cocos2dx cocos2d-x
  • 티스토리챌린지
  • 큰폴더
  • TextInputAction
  • 큰파일
  • 카카오 로그인
  • CI/CD
  • Animtaion
  • FocusScope
  • cache
  • 자동배포
  • caching
  • jks
  • actions
  • textformfield
  • 안드로이드
  • cspell
  • cocoapods-binary-cache
  • appDelegate
  • Flutter
  • code spell checker
  • UIViewController
  • flutter l10n helper
hELLO · Designed By 정상우.
zombie45

zombie's dev story

Study

함수에 같은 타입의 인수 여러개 받기

2011. 5. 23. 15:25

           void foo(char *fmt, ...)
           {
                   va_list ap, ap2;
                   int d;
                   char c, *s;

                   va_start(ap, fmt);
                   va_copy(ap2, ap);
                   while (*fmt)
                           switch(*fmt++) {
                           case 's':                       /* string */
                                   s = va_arg(ap, char *);
                                   printf("string %s\n", s);
                                   break;
                           case 'd':                       /* int */
                                   d = va_arg(ap, int);
                                   printf("int %d\n", d);
                                   break;
                           case 'c':                       /* char */
                                   /* Note: char is promoted to int. */
                                   c = va_arg(ap, int);
                                   printf("char %c\n", c);
                                   break;
                           }
                   va_end(ap);
                   ...
                   /* use ap2 to iterate over the arguments again */
                   ...
                   va_end(ap2);
           }
반응형

'Study' 카테고리의 다른 글

cocos2d 2.0  (0) 2012.10.12
Javascript array 관련 메서드  (0) 2012.10.11
cocos2d 2.0 설치  (0) 2012.10.11
산사자 업그레이드  (0) 2012.10.11
Opengl Library  (0) 2011.12.04
    'Study' 카테고리의 다른 글
    • Javascript array 관련 메서드
    • cocos2d 2.0 설치
    • 산사자 업그레이드
    • Opengl Library
    zombie45
    zombie45
    잡다한 개발

    티스토리툴바