home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a120 / 1.ddi / WATCOM_C / WAT200.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-18  |  624 b   |  28 lines

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat200.c                                             */
  3. /*------------------------------------------------------------------*/
  4. #include <stdio.h>
  5. #include <stdarg.h>
  6.  
  7. void total(char *couter_line, ...)
  8. {
  9.      int result = 0;
  10.      va_list param;
  11.      int arg;
  12.  
  13.      va_start(param, couter_line);
  14.      while ((arg = va_arg(param, int)) != 0)
  15.      {
  16.              result += arg;
  17.      }
  18.      printf(couter_line, result);
  19. }
  20.  
  21. void main()
  22. {
  23.      total("1+2+3+4+5+6+7+8+9+10 = %d",
  24.           1,2,3,4,5,6,7,8,9,10);
  25. }
  26.  
  27.  
  28.