/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
#include <stdarg.h>

void fun (int i, ...) {
    int i, j, k;;
    float f;
    va_list ap, ap2;

    va_start(ap, i);
    j = va_arg(ap, int);
    printf("j = %d\n", j);
    va_copy(ap2, ap);

    k = va_arg(ap, int);
    printf("k = %d\n", k);
    f = va_arg(ap, float);
    printf("f = %f\n", f);
    va_end(ap);

    /* use ap2 copied from ap */
    k = va_arg(ap2, int);
    printf("k = %d\n", k);
    f = va_arg(ap2, float);
    printf("f = %f\n", f);
    va_end(ap2);
}

int main() {
   fun(1, 2, 3, 4.0);
}
