﻿<?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++博客-glxhyt-最新评论</title><link>http://www.cppblog.com/glxhyt/CommentsRSS.aspx</link><description /><language>zh-cn</language><pubDate>Sun, 19 May 2013 13:10:02 GMT</pubDate><lastBuildDate>Sun, 19 May 2013 13:10:02 GMT</lastBuildDate><generator>cnblogs</generator><item><title>re: 自己工作中犯的几个小问题</title><link>http://www.cppblog.com/glxhyt/archive/2012/05/24/175035.html#175986</link><dc:creator>钟谢伟</dc:creator><author>钟谢伟</author><pubDate>Thu, 24 May 2012 01:00:00 GMT</pubDate><guid>http://www.cppblog.com/glxhyt/archive/2012/05/24/175035.html#175986</guid><description><![CDATA[可以把你遇到的问题描述的详细点吗？<img src ="http://www.cppblog.com/glxhyt/aggbug/175986.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/glxhyt/" target="_blank">钟谢伟</a> 2012-05-24 09:00 <a href="http://www.cppblog.com/glxhyt/archive/2012/05/24/175035.html#175986#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 自己工作中犯的几个小问题</title><link>http://www.cppblog.com/glxhyt/archive/2012/05/23/175035.html#175950</link><dc:creator>郭龙</dc:creator><author>郭龙</author><pubDate>Wed, 23 May 2012 15:58:00 GMT</pubDate><guid>http://www.cppblog.com/glxhyt/archive/2012/05/23/175035.html#175950</guid><description><![CDATA[@钟谢伟<br>修改之后，通过返回值传回来，这个具体深入原因我也不太理解。<br><br>看了你的随笔 &lt;&lt;函数参数传递，一二事 &gt;&gt;<br>void SetToSix(int *&amp;pTempPtr)<br>这个也可以修改成二级指针<br>void SetToSix(int **pTempPtr)<br>{<br>   *pTempPtr = &amp;nSix;<br>}<br><br>int iTemp = 5;<br>int *p = &amp;iTemp;<br>SetToSix(&amp;p);<br><br>基本如下：<br>| --------------|<br>|   0x0000 FFF1 | -----&gt; 5   <br>|---------------|<br><br>|--------------|<br>|  0x0000 FFF5 | ------&gt; 0x0000 FFF1<br>|--------------|<br><br>修改了指针 0x0000 FFF1，也就是修改了变量。<br><br>通过指针的方式给函数参数传值呢，从根本上来讲，它仍然是直接传值。<br><br>但是二级指针不好用，昨天就出现问题了，晕<br><br>1:只能取出来第一个<br>int *p[5] = {NULL,};<br>void Fun(int **p, int *iNum);<br>Fun(p, &amp;iNum) 或者Fun(&amp;(p[5]), &amp;iNum);<br>都只能取出来第一个，希望你有时间研究一下，我昨天搞晕了<br><br>2:Right<br>最后改成<br>int *p = NULL;<br>int iNum;<br>Fun(&amp;p, &amp;iNum);<br>3:Error<br>int**p = NULL;<br>Fun(p);<img src ="http://www.cppblog.com/glxhyt/aggbug/175950.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/glxhyt/" target="_blank">郭龙</a> 2012-05-23 23:58 <a href="http://www.cppblog.com/glxhyt/archive/2012/05/23/175035.html#175950#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>re: 自己工作中犯的几个小问题</title><link>http://www.cppblog.com/glxhyt/archive/2012/05/17/175035.html#175214</link><dc:creator>钟谢伟</dc:creator><author>钟谢伟</author><pubDate>Thu, 17 May 2012 08:04:00 GMT</pubDate><guid>http://www.cppblog.com/glxhyt/archive/2012/05/17/175035.html#175214</guid><description><![CDATA[是的，问题1中，传递的是指针地址的副本，函数GetA也仅仅改变的是副本指针的地址，并没有改变指针指向的位置的内容，它的效果好比：<br>//A.cpp<br>int gTemp = 1;<br>void GetA(int p)<br>{<br>   p = gTemp;<br>}<br><br>//B.cpp<br>int iInfo=2;<br>GetA(iInfo);<br>自然是不能改变iInfo的值了。<br><br>改正后可行，是因为在对piInfo进行声明的时候同时进行了定义，此时它并没有自己的地址，因此定义为返回的地址便可行了。<br><br>不知这样理解对否？<img src ="http://www.cppblog.com/glxhyt/aggbug/175214.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/glxhyt/" target="_blank">钟谢伟</a> 2012-05-17 16:04 <a href="http://www.cppblog.com/glxhyt/archive/2012/05/17/175035.html#175214#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>