📄 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:45 2005 by faqproc version 2.7 --><!-- from source file charstring.sgml dated Sat Feb 7 18:22:16 2004 --><!-- corresponding to FAQ list version 4.0 --><html><!-- Mirrored from c-faq.com/charstring/index.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:55:04 GMT --><head><meta name=GENERATOR content="faqproc"><title>Characters and Strings</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>8. Characters and Strings</H1><p><a href="strvschar.html" rel=subdocument>8.1</a>Why doesn't<pre>strcat(string, '!');</pre>work?</p><p><a href="stringeq.html" rel=subdocument>8.2</a>I'm checking a string to see if it matches a particular value.Why isn't this code working?<pre> char *string; ... if(string == "value") { /* string matches "value" */ ... }</pre></p><p><a href="assign.html" rel=subdocument>8.3</a>If I can say<pre> char a[] = "Hello, world!";</pre>why can't I say<pre> char a[14]; a = "Hello, world!";</pre></p><p><a href="malloc.html" rel=subdocument>8.4</a>I can't get <TT>strcat</TT> to work.I tried<pre> char *s1 = "Hello, "; char *s2 = "world!"; char *s3 = strcat(s1, s2);</pre>but I got strange results.</p><p><a href="strlitinit.html" rel=subdocument>8.5</a>What is the difference betweenthese initializations?<pre>char a[] = "string literal";char *p = "string literal";</pre>My programcrashes ifI try toassign a new value to <TT>p[i]</TT>.</p><p><a href="asciivals.html" rel=subdocument>8.6</a>How can I get thenumericvalue(i.e. ASCII or other character set code)corresponding to acharacter,or vice versa?</p><p><a href="substr.html" rel=subdocument>8.7</a>Does C have anything like the ``substr''(extract substring)routine present in other languages?</p><p><a href="runtimesc.html" rel=subdocument>8.8</a>I'm readingstringstyped bythe userinto an array,and then printing them out later.When the user typesa sequence like <TT>\n</TT>,whyisn't it beinghandled properly?</p><p><a href="sizeofchar.html" rel=subdocument>8.9</a>I think something's wrong with my compiler:I just noticed that <TT>sizeof('a')</TT> is 2, not 1(i.e. not <TT>sizeof(char)</TT>).</p><p><a href="wchar.html" rel=subdocument>8.10</a>I'm starting to think about multinational character sets,and I'm worried about the implicationsof making <TT>sizeof(char)</TT> be 2so that 16-bit character sets can be represented.</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/charstring/index.html by HTTrack Website Copier/3.x [XR&CO'2008], Sat, 14 Mar 2009 07:55:08 GMT --></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -