Skip to content

Instantly share code, notes, and snippets.

@OctoberWu
Created August 29, 2018 13:42
Show Gist options
  • Save OctoberWu/8716d44a41ce70fe53f2cbfaf79ecfd9 to your computer and use it in GitHub Desktop.
Save OctoberWu/8716d44a41ce70fe53f2cbfaf79ecfd9 to your computer and use it in GitHub Desktop.
/*
============================================================================
Name : va_test.c
Author : octoberwu
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
int intPrint(int val1, ...){
int value;
va_list ap;
va_start(ap, val1);
int i = 0;
value = val1;
for(i=0; i<val1; i++){
printf("%d\n", value);
value = va_arg(ap, int);
}
printf("%s", __FUNCTION__); // print current function name.
}
int main(void) {
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
intPrint(7, 5, 3, 3, 9, 6, 7);
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment