Created
January 10, 2020 03:36
-
-
Save frankie-yanfeng/00abf47fc349cd6abcf78447339c1acb to your computer and use it in GitHub Desktop.
Sentinel Example
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
#include <stdio.h> | |
#include <stdarg.h> | |
void printlist(int begin, ...) | |
{ | |
va_list ap; | |
char *p; | |
va_start(ap, begin); | |
p = va_arg(ap, char *); | |
while (p != NULL) { | |
fputs(p, stdout); | |
putchar('\n'); | |
p = va_arg(ap, char*); | |
} | |
va_end(ap); | |
} | |
int main(void) | |
{ | |
printlist(0, "hello", "world", "foo", "bar",NULL); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment