(c primer plusµÚÎå°æ) ѧϰ±Ê¼Ç
µÚ¶þÕ cÓïÑÔ¸ÅÊö
Ò»¸ö¼òµ¥µÄʵÀý
#include <stdio.h>
int main(void)
{
int num; /*¶¨Òå±äÁ¿num*/
num = 1; /*¸ø±äÁ¿num¸³Öµ*/
printf("I am a simple"); /*ʹÓÃprintf()º¯Êý*/
printf("computer.\n");
printf("My favorite number is %d because it is first.\n",num);
return 0;
}
¼òµ¥·ÖÎöÈçÏ£º
µÚÒ»¸öÓï¾ä£º#include<stdio.h> ¸æËß±àÒëÆ÷±¾Ô´Îļþ°üº¬stdio.hÖеÄËùÓÐÐÅÏ¢°üº¬º¯Êý¡¢±äÁ¿µÈ
µÚ¶þ¸öÓï¾ä£ºint main(void) ¶¨Òåmainº¯ÊýÀàÐÍΪint,²»½ÓÊÜÈκβÎÊý(void)
µÚÈýºÍµÚËĸöÓï¾ä£º¶¨ÒåÁËintÀàÐͱäÁ¿num£¬²¢¸³Öµ¸ønum
µÚÎå¡¢ÁùºÍÆßÓï¾ä£ºµ÷ÓÃÁËstdio.hÎļþÖеÄprintf()º¯Êý
µÚÁù¸öÓï¾ä£º·µ»ØÓï¾ä£¬·µ»ØֵΪ0
ÉîÈë·ÖÎö£º
µÚÒ»£º#includeÊÇcÓïÑÔµÄÔ¤´¦ÀíÆ÷Ö¸Áî(preprocessor directive),c±à¼Æ÷ÔÚ±àÒëÇ°Òª¶ÔÔ´´úÂë×öһЩ׼±¸¹¤×÷£¬Õâ³ÆΪԤ´¦Àí
µÚ¶þ£ºint main()º¯Êý£¬¼¸ºõËùÓеÄc³ÌÐò¶¼ÊÇ´ÓÕâ¸öº¯Êý¿ªÊ¼Ö´Ðеģ¬main()ÊÇc³ÌÐòµÄ»ù±¾Ä£¿é , ¶øintÔòÉùÃ÷º¯Êý·µ»ØµÄÊÇÕûÊý£¬·µ»Ø¸ø²Ù×÷ϵͳ£¬ÆäËûÉùÃ÷mainµÄÐÎʽ£º
main() /* c90±ê×¼»áÖ§³ÖÕâÖÖÐÎʽ£¬c99Ôò²»Ö§³Ö£¬×îºÃ²»ÒªÕâÑùÉùÃ÷*/
Void main() /*ÎÞ·µ»ØÖµ£¬×îºÃÒ²²»ÒªÕâÑùÉùÃ÷ */
µÚÈý£ºint num ¶¨ÒåÁËÕûÐͱäÁ¿num£¬ÔÚc³ÌÐòÖÐ,ËùÓбäÁ¿ÔÚʹÓÃ֮ǰ±ØÐ붨Òå¶øÇÒ±ØÐë¸ø³öÀàÐÍ£¬²»È»±àÒëÆ÷ͨ²»¹ý£¬»áÌáʾ±àÒë´íÎó
µÚËÄ£ºµ÷ÓÃÁËcÓïÑÔ±ê×¼º¯Êýprintf()£¬ÆäÖÐÀ¨ºÅÀïÃæµÄÊDzÎÊý£¬µ±³ÌÐòµ÷ÓÃÁËprintf()º¯Êý£¬½«¿ØÖÆȨ½»¸øprinft()º¯Êý£¬µ±Íê³Éµ÷ÓÃÁË£¬¾Í½«¿ØÖÆȨ½»¸ømain()º¯Êý
×îºóÒ»¸öÓï¾ä£ºreturn 0;ÒòΪmainº¯ÊýÊÇÕûÊýÀàÐÍ£¬ËùÒÔ±ØÐë·µ»ØÒ»¸öÕûÊýÀàÐ͵ÄÖµ£¬Ã»Óиø³ö·µ»ØÓï¾ä£¬Ïà¶Ôc99±ê×¼À´Ëµ±àÒëÆ÷»áÌáʾ±àÒë´íÎó
Ïà¹ØÎĵµ£º
±àÒëÆ÷£ºvc++6.0(ÒòΪ´ËÖÖʵÏÖÒÀÀµ±àÒëÆ÷´¦Àí)
´Ë´¦Ö»¼òÒªÐðÊöһϻúÖÆ¡£²¢¸½²¿·Ö¹Ø¼üÖ¸ÁîÐòÁС£
×¼±¸£º
1£¬¹ØÓÚEBP£º³Æ×öÕ»»ùÖ·Ö¸Õ롣ΪʲôÕâÑù˵ÄØ£¿ÎÒÃÇÏÈÀ´¿´¿´º¯Êýµ÷ÓõĹý³Ì£º
²ÎÊý´ÓÓÒµ½×óѹջ¡£
callÖ¸ÁîÖ´ÐУ¬¸ÃÖ¸Áµ¼ÖÂEIPѹջ¡£
ÿ¸öº¯ÊýÇ°Á½¾ä±Ø¶¨ÊÇ£ºpush ebp mov ebp,esp¡£Ôòca ......
ÔÚÏîÄ¿ÊôÐÔÒ³ --> ÅäÖÃÊôÐÔ --> C/C++ --> Êä³öÎļþÀïÃ棬½«»ã±àÊä³öµÄÏÂÀÁбí´ÓÎÞÁбíÑ¡ÔñΪÄãÐèÒª»ã±àÊä³öµÄÄÚÈÝ£¬±ÈÈ瓽öÁгö³ÌÐò¼¯(/FA)”£¬Èçͼ1-1£¬Í¼1-2£º
ͼ1-1
ͼ1-2
------------------------------------------------------------------------------------------------ ......
n Óñêʶ·û´ú±íÒ»¸ö³£Á¿£¬³ÆΪ·ûºÅ³£Á¿¡£ n ·ûºÅ³£Á¿Óë±äÁ¿²»Í¬£¬ËüµÄÖµÔÚÆä×÷ÓÃÓòÄÚ²»Äܸı䣬Ҳ²»ÄÜÔÙ±»¸³Öµ¡£ n ʹÓ÷ûºÅ³£Á¿µÄºÃ´¦ÊÇ£º Ø º¬ÒåÇå³þ£» Ø ÄÜ×öµ½¡°Ò»¸ÄÈ«¸Ä¡±¡£ --»°Ëµ£º²»ÖªµÀcÀïÃæÓÐûÓÐÈ«¾Ö±äÁ¿µÄ¶«¶«£¬ÓеĻ°£¬ÕâÁ½¸öµÄʵ¼ÊÓô¦ÓÐɶ×ÓÇø±ðÄØ£¿¿´¿´ÔÙ˵ Êý¾Ý½á¹¹+Ëã·¨=³ÌÐò ÖÕÓÚÖªµÀÕâ ......
http://blog.csdn.net/Ackarlix/archive/2007/08/25/1758412.aspx
WindowsÏÂCÍøÂç±à³ÌÈëÃÅ
CÓïÑÔµÄѧϰ£¬Ò»°ãµÄ·½Ê½ÊÇ£¬ÏÈѧC£¬È»ºóÊÇC++£¬×îºÃ»¹ÒªÓлã±àÓïÑÔºÍ΢»úÔÀí»ù´¡£¬È»ºó²ÅÊÇVisual C++¡£ÕâÑùµÄ·½Ê½£¬¶ÔѧϰÕßÀ´Ëµ£¬Òª»¨·ÑºÜ¶àʱ¼äºÍÄÍÁ¦¡£¶øÔÚѧУ½ÌѧÖУ¬Ò²Ã»ÓÐʱ¼äÉîÈëѧϰWindows±à³ÌµÄʵÓü¼ÊõÁË¡£
¡¡¡¡ ......
±¾ÎÄÊ×·¢µØÖ·£ºhttp://blog.csdn.net/liigo/archive/2009/09/22/4582018.aspx
תÔØÇë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/liigo
×÷Õߣºliigo, 2009/09/22
¡¡¡¡ÔÚÏÂΧÆåʱ£¬µ±Ò»¸öÆå×ÓÂäµ½ÆåÅÌÉÏ£¬Ëü»á¶ÔÖÜΧ¶Ô·½Æå×ÓµÄËÀ»î²úÉúÓ°Ï죬Èç¹û¶Ô·½Æå×ÓûÓÐÆøÁË£¨ËÀÁË£©£¬±ØÐë´ÓÆåÅÌÉÏÄõô£¨Ìá×Ó£©¡£Õâ¸ö¹ý³ÌÌåÏÖµ½Î§ÆåÈí¼þÖУ¬¾ÍÐ ......