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

»ã±à¿´cÖ®Ò»£¬¼òµ¥º¯Êýµ÷ÓÃ

¼òµ¥µÄº¯Êýµ÷Óã¬Í¨¹ý¼òµ¥µÄº¯Êýµ÷Ó÷´»ã±à¿ÉÒÔÇå³þÁ˽âÈçÏÂ
1.Õ»µ½µ×ÊÇʲô£¬ÈçºÎ²Ù×ÝÕ»µÄ£¿
2.²ÎÊýºÍÁÙʱ±äÁ¿ÊÇÒÔʲôÐÎʽÔÚÄÄ´æ·Å£¿
3.ÈçºÎ´«µÝ·µ»ØÖµ£¿
¾ÙÀý£º
#include <stdio.h>
int add(int a,int b)
{
     int c=0;
     c=a+b;
     return c;
}
int main(void)
{
     int x=0;
     int y=3;
     int z=4;
     x=add(y,z);
     return 0;
}
ÕâÊÇÒ»¸ö¼òµ¥µÄͨ¹ýµ÷Óú¯Êý¼ÆËãÁ½ÊýÖ®ºÍµÄ³ÌÐò
VC6.0Éú³ÉµÄ»ã±à´úÂëÈçÏ£º
addº¯Êý
{
0040D750   push        ebp
//°Ñmainº¯ÊýµÄebpѹջ£¬ebp=1000,esp=896
0040D751   mov         ebp,esp
//µÃµ½“Дջ»ùÖ·£¬ÕâÀïµÄеÄÒâ˼ÊÇÿ¸öº¯Êý·ÃÎÊÊôÓÚ×Ô¼ºµÄÒ»¿éÕ»ÇøÓò£¬ÆäʵÊÇÏàÁÚµÄÄÚ´æÇøÓò£¬»òÕß˵ջֻÓÐÒ»¸ö¡£ebp=896£¬esp=896
0040D753   sub         esp,44h
//ebp=896£¬esp=828
0040D756   push        ebx
0040D757   push        esi
0040D758   push        edi
//ebp=896£¬esp=816
0040D759   lea         edi,[ebp-44h]
0040D75C   mov         ecx,11h
0040D761   mov         eax,0CCCCCCCCh
0040D766   rep stos    dword ptr [edi]
//³õʼ»¯ÄÚ²¿±äÁ¿Çø
5:        int c=0;
0040D768   mov         dword ptr [ebp-4],0
//c·ÅÈë“Дջ»ùÖ·
6:        c=a+b;
0040D76F   mov         eax,dword ptr [ebp+8]
0040D772   add    &n


Ïà¹ØÎĵµ£º

C/C++ÓïÑÔÖÐÖ¸ÕëµÄÒâÒå

¿´µ½Õâ¸öÃæÊÔÌâ,¹À¼ÆºÜ¶à¸ÕѧCÖ¸ÕëµÄͬѧ¶¼»á¸ã´í.
void GetMemory(char *p)
{
// ´«µÝ½øÀ´µÄµÄֵʹµÃ*p==NULL
// ÕâÀïÐ޸ĵÄÊÇÕâ¸öº¯ÊýÄÚµÄÁÙʱָÕë±äÁ¿pµÄÖµ
p = (char *)malloc(100);
}
void Test(void)
{
char *str = NULL;
// ´«µÝ½øÈ¥µÄÊÇstrµÄÖµNULL
GetMemory(str);
// ÕâÀïstrÖ¸Õë² ......

CÓïÑÔÎļþÏà¹Ø²Ù×÷

CÓïÑÔÎļþ²Ù×÷½Ó´¥ºÜ¾ÃÁË£¬Ò»Ö±Ã»ÓÐ×ܽáÏà¹ØÄÚÈÝ£¬½ñÌìÓõ½Á˾ÍÈ¥ÕÒÁËÕÒÏà¹ØÄÚÈÝ¡£
ÔÚANSI CÖУ¬¶ÔÎļþµÄ²Ù×÷·ÖΪÁ½ÖÖ·½Ê½£¬¼´Á÷ʽÎļþ²Ù×÷ºÍI/OÎļþ²Ù×÷
typedef struct {
int level; /* fill/empty level of buffer */
unsigned flags; /* File status flags */
char fd; /* File descriptor */
unsigned char hold ......

C/C++ÖÐmallocºÍnewµÄÇø±ð


¡¡¡¡1£¬mallocÓëfreeÊÇC++/CÓïÑԵıê×¼¿âº¯Êý£¬new/deleteÊÇC++µÄÔËËã·û¡£ËüÃǶ¼¿ÉÓÃÓÚÉêÇ붯̬ÄÚ´æºÍÊÍ·ÅÄÚ´æ¡£
¡¡¡¡2£¬¶ÔÓÚ·ÇÄÚ²¿Êý¾ÝÀàÐ͵ĶÔÏó¶øÑÔ£¬¹âÓÃmaloc/freeÎÞ·¨Âú×㶯̬¶ÔÏóµÄÒªÇ󡣶ÔÏóÔÚ´´½¨µÄͬʱҪ×Ô¶¯Ö´Ðй¹Ô캯Êý£¬¶ÔÏóÔÚÏûÍö֮ǰҪ×Ô¶¯Ö´ÐÐÎö¹¹º¯Êý¡£ÓÉÓÚmalloc/freeÊǿ⺯Êý¶ø²»ÊÇÔËËã·û£¬²»ÔÚ±àÒëÆ ......

CÓïÑԻص÷º¯ÊýʹÓÃ

ʲôÊǻص÷º¯Êý£¿
¡¡¡¡¼ò¶øÑÔÖ®£¬»Øµ÷º¯Êý¾ÍÊÇÒ»¸öͨ¹ýº¯ÊýÖ¸Õëµ÷Óõĺ¯Êý¡£Èç¹ûÄã°Ñº¯ÊýµÄÖ¸Õ루µØÖ·£©×÷Ϊ²ÎÊý´«µÝ¸øÁíÒ»¸öº¯Êý£¬µ±Õâ¸öÖ¸Õë±»ÓÃΪµ÷ÓÃËüËùÖ¸ÏòµÄº¯Êýʱ£¬ÎÒÃǾÍ˵ÕâÊǻص÷º¯Êý¡£
¡¡¡¡ÎªÊ²Ã´ÒªÊ¹Óûص÷º¯Êý£¿
¡¡¡¡ÒòΪ¿ÉÒ԰ѵ÷ÓÃÕßÓë±»µ÷ÓÃÕß·Ö¿ª¡£µ÷ÓÃÕß²»¹ØÐÄË­ÊDZ»µ÷ÓÃÕߣ¬ËùÓÐËüÐèÖªµÀµÄ£¬Ö»ÊÇ´æÔÚ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ