⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.html

📁 this is a mirrored site c-faq. thought might need offline
💻 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:47 2005 by faqproc version 2.7 --><!-- from source file misc0.sgml dated Sat Nov 24 13:43:27 2001 --><!-- corresponding to FAQ list version 4.0 --><html><!-- Mirrored from c-faq.com/misc/index.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:57:01 GMT --><head><meta name=GENERATOR content="faqproc"><title>Miscellaneous</title></head><body bgcolor="#ffffff">&nbsp;<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>20. Miscellaneous</H1><p><a href="multretval.html" rel=subdocument>20.1</a>How can I returnmultiplevalues from a function?</p><p><a href="ragged.html" rel=subdocument>20.2</a>What's a good data structure to usefor storing lines of text?I started to usefixed-sizearrays of arrays of <TT>char</TT>,but they're just too restrictive.</p><p><a href="argv.html" rel=subdocument>20.3</a>How can I open files mentioned on the command line,and parse option flags?</p><p><a href="errno.html" rel=subdocument>20.4</a>What's the right wayto use <TT>errno</TT>?</p><p><a href="binaryfiles.html" rel=subdocument>20.5</a>How can I write data files which can be read on other machineswith differentword size,byte order,or floating pointformats?</p><p><a href="symtab.html" rel=subdocument>20.6</a>If I have a <TT>char&nbsp;*</TT> variablepointing tothe name of a function,how can I call that function?Code like<pre>	extern int func(int, int);	char *funcname = "func";	int r = (*funcname)(1, 2);</pre>or<pre>	r = (*(int (*)(int, int))funcname)(1, 2);</pre>doesn't seem to work.</p><p><a href="intovf.html" rel=subdocument>20.6b</a>How can I ensure that integer arithmetic doesn't overflow?</p><p><a href="bitmanip.html" rel=subdocument>20.7</a>How can I manipulate individual bits?</p><p><a href="bitsets.html" rel=subdocument>20.8</a>How can I implement sets or arrays of bits?</p><p><a href="endiantest.html" rel=subdocument>20.9</a>How can I determine whether a machine'sbyte orderis big-endian or little-endian?</p><p><a href="byteswap.html" rel=subdocument>20.9b</a>How do I swap bytes?</p><p><a href="hexio.html" rel=subdocument>20.10</a>How can I convert integers tobinary orhexadecimal?</p><p><a href="base2.html" rel=subdocument>20.11</a>Can I use base-2 constants(something like <TT>0b101010</TT>)?<br>Is there a<TT>printf</TT> format for binary?</p><p><a href="bitcount.html" rel=subdocument>20.12</a>What is the most efficient way to count the number of bitswhich are set inan integer?</p><p><a href="efficiency.html" rel=subdocument>20.13</a>What's the best way of making my program efficient?</p><p><a href="eff2.html" rel=subdocument>20.14</a>Are pointers really faster than arrays?How much do function calls slow things down?Is <TT>++i</TT> faster than <TT>i&nbsp;=&nbsp;i&nbsp;+&nbsp;1</TT>?</p><p><a href="shifts.html" rel=subdocument>20.15</a>I've been replacing multiplications and divisionswith shift operators,because shifting is more efficient.</p><p><a href="unsshift.html" rel=subdocument>20.15b</a>People claim that optimizing compilers are goodand that we no longer have to write things in assembler for speed,butmy compilercan't evenreplace <TT>i/=2</TT> with a shift.</p><p><a href="swapnotemp.html" rel=subdocument>20.15c</a>How can I swap two values without using a temporary?</p><p><a href="switchimpl.html" rel=subdocument>20.16</a>Which is more efficient,a <TT>switch</TT> statement or an <TT>if</TT>/<TT>else</TT> chain?</p><p><a href="strswitch.html" rel=subdocument>20.17</a>Is there a way to <TT>switch</TT> on strings?</p><p><a href="nonconstcase.html" rel=subdocument>20.18</a>Is there a way to have non-constant <TT>case</TT> labels(i.e. ranges or arbitrary expressions)?</p><p><a href="returnparens.html" rel=subdocument>20.19</a>Are the outer parenthesesin <TT>return</TT> statementsreally optional?</p><p><a href="nestcomment.html" rel=subdocument>20.20</a>Why don't C comments nest?How am I supposed to comment out code containing comments?Arecommentslegal inside quoted strings?</p><p><a href="multibreak.html" rel=subdocument>20.20b</a>Why isn't there a numbered, multi-level <TT>break</TT> statementto break out of several loops at once?What am I supposed to use instead, a <TT>goto</TT>?</p><p><a href="funkyasgnop.html" rel=subdocument>20.21</a>There seem to be a few missing operators, like <TT>^^</TT>, <TT>&amp;&amp;=</TT>, and <TT>-&gt;=</TT>.</p><p><a href="circshift.html" rel=subdocument>20.21a</a>Does C have circular shift operators?</p><p><a href="quintplus.html" rel=subdocument>20.21b</a>Is C a great language, or what?Where else could you write something like<TT>a+++++b</TT>?</p><p><a href="colonequal.html" rel=subdocument>20.22</a>If the assignment operator were <TT>:=</TT>,wouldn't it then be harder to accidentally write things like<TT>if(a&nbsp;=&nbsp;b)</TT> ?</p><p><a href="with.html" rel=subdocument>20.23</a>Does C have an equivalent to Pascal's<TT>with</TT> statement?</p><p><a href="nestfcns.html" rel=subdocument>20.24</a>Why doesn't C have nested functions?</p><p><a href="assert.html" rel=subdocument>20.24b</a>What is <TT>assert()</TT>and when would I use it?</p><p><a href="mixlang.html" rel=subdocument>20.25</a>How can I call FORTRAN(C++, BASIC, Pascal,Ada, LISP) functions from C?(And vice versa?)</p><p><a href="langtran.html" rel=subdocument>20.26</a>Does anyone know of a programfor convertingPascal or FORTRAN(orLISP,Ada,awk,``Old'' C,...)to C?</p><p><a href="cplusplus.html" rel=subdocument>20.27</a>Is C++ a superset of C?What are the differences between C and C++?Can I use a C++ compiler to compile C code?</p><p><a href="soundex.html" rel=subdocument>20.28</a>I needa sort of an ``approximate'' strcmp routine, for comparingtwo strings for close, but not necessarily exact, equality.</p><p><a href="hash.html" rel=subdocument>20.29</a>What is hashing?</p><p><a href="gaussian.html" rel=subdocument>20.30</a>How can I generate random numbers with anormal orGaussian distribution?</p><p><a href="zeller.html" rel=subdocument>20.31</a>How can I find the day of the week given the date?</p><p><a href="leapyear.html" rel=subdocument>20.32</a>Is <TT>(year&nbsp;%&nbsp;4&nbsp;==&nbsp;0)</TT> an accurate test for leap years?(Was 2000 a leap year?)</p><p><a href="leapsec.html" rel=subdocument>20.33</a>Why can <TT>tm_sec</TT>in the <TT>tm</TT> structurerange from 0 to 61,suggesting that there can be 62 seconds in a minute?</p><p><a href="quine.html" rel=subdocument>20.34</a>Here's a good puzzle:howdo you write a program which produces its own source code asoutput?</p><p><a href="duff.html" rel=subdocument>20.35</a>What is ``Duff's Device''?</p><p><a href="ioccc.html" rel=subdocument>20.36</a>When will the nextInternationalObfuscated C Code Contest(IOCCC)be held?How do I submit contest entries?Who won this year's IOCCC?How can I get a copy ofthecurrent andpreviouswinning entries?</p><p><a href="entry.html" rel=subdocument>20.37</a>What was the <TT>entry</TT> keywordmentioned in K&amp;R1?</p><p><a href="nameofc.html" rel=subdocument>20.38</a>Where does the name ``C'' come from, anyway?</p><p><a href="pronounce.html" rel=subdocument>20.39</a>How do you pronounce ``<TT>char</TT>''?What's that funny name for the ``<TT>#</TT>'' character?</p><p><a href="lvalue.html" rel=subdocument>20.39b</a>What do ``lvalue'' and ``rvalue'' mean?</p><p><a href="faqavail.html" rel=subdocument>20.40</a>Where can I get extra copies of this list?</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>&nbsp;<a href="../eskimo.html">about eskimo</a>&nbsp;<a href="../search.html">search</a>&nbsp;<a href="../feedback.html">feedback</a>&nbsp;<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/misc/index.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:57:19 GMT --></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -