Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

95 lines
4.0KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>va_arg (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="va_arg (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="va_arg (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="Stdarg.html#Stdarg" rel="up" title="Stdarg">
  16. <link href="va_005fend.html#va_005fend" rel="next" title="va_end">
  17. <link href="va_005fstart.html#va_005fstart" rel="prev" title="va_start">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="va_005farg"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="va_005fend.html#va_005fend" accesskey="n" rel="next">va_end</a>, Previous: <a href="va_005fstart.html#va_005fstart" accesskey="p" rel="prev">va_start</a>, Up: <a href="Stdarg.html#Stdarg" accesskey="u" rel="up">Stdarg</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="Extract-a-value-from-argument-list"></a>
  54. <h4 class="subsection">14.1.2 Extract a value from argument list</h4>
  55. <a name="index-va_005farg"></a>
  56. <p><strong>Synopsis</strong>
  57. </p><div class="example">
  58. <pre class="example">#include &lt;stdarg.h&gt;
  59. <var>type</var> va_arg(va_list <var>ap</var>, <var>type</var>);
  60. </pre></div>
  61. <p><strong>Description</strong><br>
  62. <code>va_arg</code> returns the next unprocessed value from a variable
  63. argument list <var>ap</var> (which you must previously create with
  64. <var>va_start</var>). Specify the type for the value as the second parameter
  65. to the macro, <var>type</var>.
  66. </p>
  67. <p>You may pass a <code>va_list</code> object <var>ap</var> to a subfunction, and use
  68. <code>va_arg</code> from the subfunction rather than from the function
  69. actually declared with an ellipsis in the header; however, in that case
  70. you may <em>only</em> use <code>va_arg</code> from the subfunction. ANSI C does
  71. not permit extracting successive values from a single variable-argument
  72. list from different levels of the calling stack.
  73. </p>
  74. <p>There is no mechanism for testing whether there is actually a next
  75. argument available; you might instead pass an argument count (or some
  76. other data that implies an argument count) as one of the fixed arguments
  77. in your function call.
  78. </p>
  79. <p><strong>Returns</strong><br>
  80. <code>va_arg</code> returns the next argument, an object of type <var>type</var>.
  81. </p>
  82. <p><strong>Portability</strong><br>
  83. ANSI C requires <code>va_arg</code>.
  84. </p>
  85. </body>
  86. </html>