﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-qqjianyue代码工-随笔分类-CPP base</title><link>http://www.cppblog.com/jianyue/category/8538.html</link><description>砌C/C++代码</description><language>zh-cn</language><lastBuildDate>Sun, 19 Oct 2008 14:44:09 GMT</lastBuildDate><pubDate>Sun, 19 Oct 2008 14:44:09 GMT</pubDate><ttl>60</ttl><item><title>const char，char const，const char*，char* const</title><link>http://www.cppblog.com/jianyue/archive/2008/10/19/64438.html</link><dc:creator>Qzi</dc:creator><author>Qzi</author><pubDate>Sun, 19 Oct 2008 13:48:00 GMT</pubDate><guid>http://www.cppblog.com/jianyue/archive/2008/10/19/64438.html</guid><wfw:comment>http://www.cppblog.com/jianyue/comments/64438.html</wfw:comment><comments>http://www.cppblog.com/jianyue/archive/2008/10/19/64438.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jianyue/comments/commentRss/64438.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jianyue/services/trackbacks/64438.html</trackback:ping><description><![CDATA[const char与char const相同，都是都表示标识一个char的变量不能改变它的值，例如：<br>const char a = 'a'; //a变量就只能够是'a'了，不能再改变它的值<br><br>const char* p1 = &amp;a;<br>char* const p2 = &amp;a;<br>*p1不能改变；<br>p2不能改变；<br>主要看待究竟const是否修饰*号（即*号是否在const后面）就行，如果修饰，则代表是*p是常量，如果不修饰则p是常量。<br>所以char const * p与const char*相同，因为*号在const后面。<br><br>注意：常量规定是在编译时候检测的，运行时候是可以改变的，例如上面的*p1为常量，但是可以赋值p1=&amp;b，其中b='b'；那么*p1的值也会变成'b'了。<br><br> <img src ="http://www.cppblog.com/jianyue/aggbug/64438.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jianyue/" target="_blank">Qzi</a> 2008-10-19 21:48 <a href="http://www.cppblog.com/jianyue/archive/2008/10/19/64438.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>