Created
August 29, 2018 13:42
-
-
Save OctoberWu/8716d44a41ce70fe53f2cbfaf79ecfd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
============================================================================ | |
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