📄 index.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN"><!-- This collection of hypertext pages is Copyright 1995-2005 by Steve Summit. --><!-- Content from the book "C Programming FAQs: Frequently Asked Questions" --><!-- (Addison-Wesley, 1995, ISBN 0-201-84519-9) is made available here by --><!-- permission of the author and the publisher as a service to the community. --><!-- It is intended to complement the use of the published text --><!-- and is protected by international copyright laws. --><!-- The on-line content may be accessed freely for personal use --><!-- but may not be published or retransmitted without explicit permission. --><!-- --><!-- this page built Sat Dec 24 21:47:46 2005 by faqproc version 2.7 --><!-- from source file varargs.sgml dated Sun Nov 25 08:09:42 2001 --><!-- corresponding to FAQ list version 4.0 --><html><!-- Mirrored from c-faq.com/varargs/index.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:56:15 GMT --><head><meta name=GENERATOR content="faqproc"><title>Variable-Length Argument Lists</title></head><body bgcolor="#ffffff"> <a href="../index-2.html"><img src="../images/buttontop.gif" alt="top/contents"></a><a href="../search.html"><img src="../images/buttonsrch.gif" alt="search"></a><hr><H1>15. Variable-Length Argument Lists</H1><p><a href="protos.html" rel=subdocument>15.1</a>I heard that you have to <TT>#include</TT> <TT><stdio.h></TT>before calling <TT>printf</TT>.Why?</p><p><a href="promos.html" rel=subdocument>15.2</a>How can <TT>%f</TT> be usedfor both <TT>float</TT> and <TT>double</TT> argumentsin <TT>printf</TT>?Aren't they different types?</p><p><a href="proto2.html" rel=subdocument>15.3</a>I had a frustrating problem which turned out to be caused by the line<pre> printf("%d", n);</pre>where <TT>n</TT> was actually a <TT>long int</TT>.I thought that ANSI function prototypeswere supposed to guard against argument type mismatches like this.</p><p><a href="varargs1.html" rel=subdocument>15.4</a>How can I write a function that takes a variable number ofarguments?</p><p><a href="vprintf.html" rel=subdocument>15.5</a>How can I write a function that takes a format string and avariable number of arguments, like <TT>printf</TT>, and passes them to<TT>printf</TT> to do most of the work?</p><p><a href="vscanf.html" rel=subdocument>15.6</a>How can I write a function analogous to <TT>scanf</TT>,i.e. that accepts similar arguments,andcalls <TT>scanf</TT> to do most of the work?</p><p><a href="oldvarargs.html" rel=subdocument>15.7</a>I havea pre-ANSIcompiler,without <TT><stdarg.h></TT>.What can I do?</p><p><a href="nargs.html" rel=subdocument>15.8</a>How can I discover how many arguments a function was actuallycalled with?</p><p><a href="onefixedarg.html" rel=subdocument>15.9</a>My compiler isn't letting me declare a function<pre> int f(...) { }</pre>i.e. accepting a variable number of arguments,butwith no fixed arguments at all.</p><p><a href="float.html" rel=subdocument>15.10</a>I have a varargs function which accepts a <TT>float</TT> parameter.Why isn't<pre>va_arg(argp, float)</pre>working?</p><p><a href="funcptr.html" rel=subdocument>15.11</a>I can't get <TT>va_arg</TT> to pull in an argumentof type pointer-to-function.</p><p><a href="handoff.html" rel=subdocument>15.12</a>How can I write a function which takes a variable number ofarguments and passes them to some other function (which takes a variable number of arguments)?</p><p><a href="invvarargs.html" rel=subdocument>15.13</a>How can I call a function with an argument list built up at run time?</p><hr><p><a href="../index-2.html">top</a></p><p><a href="../questions.html"><img src="../images/buttontop.gif" alt="contents"></a><a href="../search.html"><img src="../images/buttonsrch.gif" alt="search"></a><br><a href="../about.html">about this FAQ list</a> <a href="../eskimo.html">about eskimo</a> <a href="../search.html">search</a> <a href="../feedback.html">feedback</a> <a href="copyright.html">copyright</a><p>Hosted by<a href="http://www.eskimo.com/"><img src="../../www.eskimo.com/img/link/eskitiny.gif" alt="Eskimo North"></a></p></body><!-- Mirrored from c-faq.com/varargs/index.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:56:21 GMT --></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -