»ã±à¿´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Öк¯ÊýÃû³Æ²»Í¬¡£È»¶ødllµÄµ¼³öº¯Êýͨ³£ÊDZê×¼C¶¨ÒåµÄ£¬Èñê×¼C±àдµÄdllº¯Êý¶¨ÒåÔÚCºÍC++±àÒëÆ÷϶¼ÄܱàÒëͨ¹ý£¬Í¨³£»áʹÓÃÒÔϵĸñʽ£º£¨Õâ¸ö¸ñʽÔںܶà³ÉÊìµÄ´úÂëÖкܳ£¼û£©
#ifdef __cplusplus extern "C"
{
#endif
// ......
¡¡¡¡1£¬mallocÓëfreeÊÇC++/CÓïÑԵıê×¼¿âº¯Êý£¬new/deleteÊÇC++µÄÔËËã·û¡£ËüÃǶ¼¿ÉÓÃÓÚÉêÇ붯̬ÄÚ´æºÍÊÍ·ÅÄÚ´æ¡£
¡¡¡¡2£¬¶ÔÓÚ·ÇÄÚ²¿Êý¾ÝÀàÐ͵ĶÔÏó¶øÑÔ£¬¹âÓÃmaloc/freeÎÞ·¨Âú×㶯̬¶ÔÏóµÄÒªÇ󡣶ÔÏóÔÚ´´½¨µÄͬʱҪ×Ô¶¯Ö´Ðй¹Ô캯Êý£¬¶ÔÏóÔÚÏûÍö֮ǰҪ×Ô¶¯Ö´ÐÐÎö¹¹º¯Êý¡£ÓÉÓÚmalloc/freeÊǿ⺯Êý¶ø²»ÊÇÔËËã·û£¬²»ÔÚ±àÒëÆ ......
Ò»¸ö¼òµ¥µÄС³ÌÐò, ÔÌâÄ¿¼û<CÓïÑÔ³ÌÐòÉè¼Æ-ÏÖ´ú·½·¨>µÚ°ËÕÂÁ·Ï°13.
ÓÉÓÚ×Ô¼ºÖ»¿´µ½µÚ°ËÕÂ, ËùÒÔ, ²»¸ÒóȻʹÓú¯ÊýµÈÆäËûÄÚÈÝ, ¸ßÊÖÇë·ÅÉù´óЦ.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define ROWS 10
#define COLS 10
/**
* @author: selfimpr
* @blog: http:// ......
1.10.3£¬voidÖ¸Õë
¡¾¹æÔò 1-35¡¿Ç§ÍòСÐÄÓÖСÐÄʹÓÃvoidÖ¸ÕëÀàÐÍ¡£
°´ÕÕ ANSI(American National Standards Institute)±ê×¼£¬²»ÄÜ¶Ô voidÖ¸Õë½øÐÐËã·¨²Ù×÷£¬¼´ÏÂÁвÙ×÷¶¼ÊDz»ºÏ·¨µÄ£º
void * pvoid;
pvoid++; //ANSI£º´íÎó
pvoid += 1; //ANSI£º´íÎó
ANSI ±ê×¼Ö®ËùÒÔÕâÑùÈ϶¨£¬ÊÇÒòΪËü¼á³Ö£º½øÐÐËã·¨²Ù×÷µÄÖ¸Õë±ØÐëÊ ......