Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c++/c±à³Ì×¢ÒâÊÂÏî

ÈÝÒ×´íÎóµÄʹÓÃÖ¸Õë:
void GetMemory(char *p, int num)
{
p = (char *)malloc(sizeof(char) * num);
}
void Test(void)
{
char *str = NULL;
GetMemory(str, 100); // str ÈÔȻΪ NULL
strcpy(str, "hello"); // ÔËÐдíÎó
}
벡³öÔÚº¯ÊýGetMemory ÖС£±àÒëÆ÷×ÜÊÇҪΪº¯ÊýµÄÿ¸ö²ÎÊýÖÆ×÷ÁÙʱ¸±±¾£¬Ö¸Õë
²ÎÊýp µÄ¸±±¾ÊÇ _p£¬±àÒëÆ÷ʹ _p = p¡£Èç¹ûº¯ÊýÌåÄڵijÌÐòÐÞ¸ÄÁË_p µÄÄÚÈÝ£¬¾Íµ¼ÖÂ
²ÎÊýp µÄÄÚÈÝ×÷ÏàÓ¦µÄÐ޸ġ£Õâ¾ÍÊÇÖ¸Õë¿ÉÒÔÓÃ×÷Êä³ö²ÎÊýµÄÔ­Òò¡£ÔÚ±¾ÀýÖУ¬_p ÉêÇë
ÁËеÄÄڴ棬ֻÊÇ°Ñ_p ËùÖ¸µÄÄÚ´æµØÖ·¸Ä±äÁË£¬µ«ÊÇp Ë¿ºÁδ±ä¡£ËùÒÔº¯ÊýGetMemory
²¢²»ÄÜÊä³öÈκζ«Î÷¡£ÊÂʵÉÏ£¬Ã¿Ö´ÐÐÒ»´ÎGetMemory ¾Í»áй¶һ¿éÄڴ棬ÒòΪûÓÐÓÃ
free ÊÍ·ÅÄÚ´æ¡£
ΪʲôҪÓÐnewºÍdelete£¬ÓÃmallocºÍfree²»¹»Âð£¿
MallocÓëfreeÊǿ⺯Êý¶ø²»ÊDzÙ×÷ÔËËã·û£¬²»Äܱ»¹¹Ô캯ÊýÓëÎö¹¹º¯Êý×Ô¶¯µ÷ÓÃ
Èç¹ûÓÃfree ÊÍ·Å¡°new ´´½¨µÄ¶¯Ì¬¶ÔÏó¡±£¬ÄÇô¸Ã¶ÔÏóÒòÎÞ·¨Ö´ÐÐÎö¹¹º¯Êý¶ø¿ÉÄÜ
µ¼Ö³ÌÐò³ö´í¡£Èç¹ûÓÃdelete ÊÍ·Å¡°malloc ÉêÇëµÄ¶¯Ì¬Äڴ桱£¬ÀíÂÛÉϽ²³ÌÐò²»»á³ö´í£¬
µ«ÊǸóÌÐòµÄ¿É¶ÁÐԺܲËùÒÔnew/delete ±ØÐëÅä¶ÔʹÓã¬malloc/free Ò²Ò»Ñù¡£
void Function(int)Óëint Function (int)±àÒëÆ÷Çø·Ö²»³öÖØÔغ¯Êý£¬ÖØÔغ¯ÊýÖÁÉÙÔÚ²ÎÊý¸öÊý¡¢²ÎÊýÀàÐÍ»ò²ÎÊý˳ÐòÉÏÓÐËù²»Í¬¡£
¶ÔÓÚ·ÇÄÚ²¿Êý¾ÝÀàÐ͵ÄÊäÈë²ÎÊý£¬Ó¦¸Ã½«¡°Öµ´«µÝ¡±µÄ·½Ê½¸ÄΪ¡°const ÒýÓô«
µÝ¡±£¬Ä¿µÄÊÇÌá¸ßЧÂÊ¡£ÀýÈ罫void Func(A a) ¸ÄΪvoid Func(const A &a)¡£
¶ÔÓÚÄÚ²¿Êý¾ÝÀàÐ͵ÄÊäÈë²ÎÊý£¬²»Òª½«¡°Öµ´«µÝ¡±µÄ·½Ê½¸ÄΪ¡°const ÒýÓô«µÝ¡±¡£
·ñÔò¼È´ï²»µ½Ìá¸ßЧÂʵÄÄ¿µÄ£¬ÓÖ½µµÍÁ˺¯ÊýµÄ¿ÉÀí½âÐÔ¡£ÀýÈçvoid Func(int x) ²»
Ó¦¸Ã¸ÄΪvoid Func(const int &x)¡£
Èκβ»»áÐÞ¸ÄÊý¾Ý³ÉÔ±µÄº¯Êý¶¼Ó¦¸ÃÉùÃ÷Ϊconst ÀàÐÍ¡£Èç¹ûÔÚ±àдconst ³ÉÔ±º¯
Êýʱ£¬²»É÷ÐÞ¸ÄÁËÊý¾Ý³ÉÔ±£¬»òÕßµ÷ÓÃÁËÆäËü·Çconst ³ÉÔ±º¯Êý£¬±àÒëÆ÷½«Ö¸³ö´íÎó£¬
ÕâÎÞÒÉ»áÌá¸ß³ÌÐòµÄ½¡×³ÐÔ¡£
int GetCount(void) const; // const ³ÉÔ±º¯Êý


Ïà¹ØÎĵµ£º

C³£Óú¯Êý

¼ì²é¿Õ¸ñ×Ö·û
#include <ctype.h>
int isspace ( int c );
http://www.cplusplus.com/reference/clibrary/cctype/isspace/
Checks if parameter c is a white-space character.For the purpose of this function, standard white-space characters are:
' '
(0x20)
space (SPC)
'\t'
(0x09)
horizontal tab ......

C/C++Êý×éÃûÓëÖ¸ÕëÇø±ðÉîÈë̽Ë÷

 
ÒýÑÔ
¡¡¡¡Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++Ï ......

C±ê×¼¿âÍ·Îļþ assert.h

 C±ê×¼¿âÍ·Îļþ assert.h
@º¯ÊýÃû³Æ:   assert
º¯ÊýÔ­ÐÍ:   void assert(int exp)
º¯Êý¹¦ÄÜ:   Õï¶ÏÀࣺ±í´ïʽ½á¹ûÕýÈ·ÐÔ²âÊÔ²¢¿Éʹ³ÌÐòÖÐÖ¹
º¯Êý·µ»Ø:  
²ÎÊý˵Ã÷:   ½«´íÎóÐÅÏ¢Êä³öµ½Á÷stderrÖУ¬Èç¹ûexpΪ0£¬ÔòÖÐÖ¹³ÌÐòÖ´ÐÐ.exp-±í´ïʽ
ËùÊôÎļþ: & ......

´ÓC++µ½JAVA(1) ÔÚCSDN²©¿ÍÖв¿Êð¼°ÔËÐÐJAVA Applet

write by ¾ÅÌìÑãôá(JTianLing) -- blog.csdn.net/vagrxie ÌÖÂÛÐÂÎÅ×é¼°Îļþ Technorati ±êÇ©: JAVA,JAVA Applet,Applet Tag,Deploy Applet,´ÓC++µ½JAVA   Ç°ÑÔ Ôø¾­£¬ÎÒÓÐÒ»¸öÃÎÏ룬ÄǾÍÊÇÎҵijÌÐòÄÜÈÃÈ˲»ÐèÒªÏÂÔؾÍÄÜͨ¹ýä¯ÀÀÆ÷ÔËÐУ¬¿ÉϧѧϰµÄC,C++µÈ¶¼²»¾ß±¸´ËÄÜÁ¦£¬Ñ§Ï°ÍêPythonºó£¬·¢ÏÖÆäÒ²½ö½öÊÇÒÔ·þÎñÆ÷ ......

ʲôÊÇÐÅÔë±È S/N ¡¢ÔØÔë±È C/N Óë Eb/N0 £¿

ÐÅÔë±È( S N )ÊÇÖ¸´«ÊäÐźŵÄƽ¾ù¹¦ÂÊÓë¼ÓÐÔÔëÉùµÄƽ¾ù¹¦ÂÊÖ®±È¡£
ÔØÔë±È(C N )Ö¸ÒѾ­µ÷ÖƵÄÐźŵÄƽ¾ù¹¦ÂÊÓë¼ÓÐÔÔëÉùµÄƽ¾ù¹¦ÂÊÖ®±È¡£
ËüÃÇͨ³£¶¼ÒÔ¶ÔÊýµÄ·½Ê½À´¼ÆË㣬µ¥Î»ÎªdB¡£
ÐÅÔë±ÈÓëÔØÔë±ÈÇø±ðÔÚÓÚ£¬ÔØÔë±ÈÖÐÒѵ÷ÐźŵŦÂÊ°üÀ¨ÁË´«ÊäÐźŵŦÂʺ͵÷ÖÆÔز¨µÄ¹¦ÂÊ£¬¶øÐÅÔë±ÈÖнö°üÀ¨´«ÊäÐźŵŦÂÊ£¬Á½ÕßÖ®¼äÏà²îÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ