Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. ```C
  2. #include <stdio.h>
  3. #include <stdarg.h>
  4.  
  5. void print_args(int count, ...);
  6.  
  7. int main(int argc, char* argv[]) {
  8. print_args(5,1,2,3,4,5);
  9. return 0;
  10. }
  11.  
  12. void print_args(int count, ...) {
  13. int i, value;
  14. va_list arg_ptr;
  15. va_start(arg_ptr, count);
  16. for(i=0; i<count; i++) {
  17. value = va_arg(arg_ptr,int);
  18. printf("position %d = %d\n", i+1, value);
  19. }
  20. va_end(arg_ptr);
  21. }
  22. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement