C/C++Ö¸Õë
ºÎΪָÕë £¿
¡¡¡¡Ö¸Õë»ù±¾ÉϺÍÆäËüµÄ±äÁ¿Ò»Ñù£¬Î¨Ò»µÄÒ»µã²»Í¬¾ÍÊÇÖ¸Õë²¢²»°üº¬Êµ¼ÊµÄÊý¾Ý£¬¶øÊÇ°üº¬ÁËÒ»¸öÖ¸ÏòÄÚ´æλÖõĵØÖ·£¬Äã¿ÉÒÔÔÚÕâ¸öµØÖ·ÕÒµ½Ä³Ð©ÐÅÏ¢¡£ÕâÊÇÒ»¸öºÜÖØÒªµÄ¸ÅÄ²¢ÇÒÐí¶à³ÌÐò»òÕß˼Ï붼Êǽ«Ö¸Õë×÷ΪËüÃǵÄÉè¼Æ»ù´¡£¬ÀýÈçÁ´±í¡£
¿ªÊ¼
¡¡¡¡ÈçºÎ¶¨ÒåÒ»¸öÖ¸Õ룿ßÀ£¬¾ÍÏñ¶¨ÒåÆäËüµÄ±äÁ¿Ò»Ñù£¬²»¹ýÄ㻹ÐèÒªÔÚ±äÁ¿Ãû֮ǰÌí¼ÓÒ»¸öÐǺš£ÀýÈ磬ÏÂÃæµÄ´úÂë´´½¨ÁËÁ½¸öÖ¸ÏòÕûÊýµÄÖ¸Õ룺
int* pNumberOne;
int* pNumberTwo;
¡¡¡¡×¢Òâµ½±äÁ¿ÃûµÄǰ׺“p”ÁËÂð£¿ÕâÊDZàд´úÂëµÄÒ»¸öÏ°¹ß£¬ÓÃÀ´±íʾÕâ¸ö±äÁ¿ÊÇÒ»¸öÖ¸Õë¡£
¡¡¡¡ÏÖÔÚ£¬ÈÃÎÒÃÇ°ÑÕâЩָÕëÖ¸ÏòһЩʵ¼ÊµÄÖµ°É£º
pNumberOne = &some_number;
pNumberTwo = &some_other_number;
¡¡¡¡“&”±êÖ¾Ó¦¸Ã¶Á×÷“the address of£¨……µÄµØÖ·£©”£¬ËüµÄ×÷ÓÃÊÇ·µ»ØÒ»¸ö±äÁ¿µÄÄÚ´æµØÖ·£¬¶ø²»ÊÇÕâ¸ö±äÁ¿±¾Éí¡£ÄÇôÔÚÕâ¸öÀý×ÓÖУ¬pNumberOne¾ÍÊÇsome_numberµÄµØÖ·£¬Òà³Æ×÷pNumberOneÖ¸Ïòsome_number¡£
¡¡¡¡ÏÖÔÚ£¬Èç¹ûÎÒÃÇÏëʹÓÃsome_numberµÄµØÖ·µÄ»°£¬ÄÇôÎÒÃǾͿÉÒÔʹÓÃpNumberOneÁË¡£Èç¹ûÎÒÃÇÏ£Íû¾ÓÉpNumberOne¶øʹÓÃsome_numberµÄÖµµÄ»°£¬ÎÒÃÇ¿ÉÒÔÓÃ*pNumberOne¡£“*”Ó¦¸Ã¶Á×÷“the memory location pointed to by£¨ÓÉ……Ö¸ÏòµÄÄÚ´æλÖã©”£¬ËüÓÃÀ´È¡µÃÖ¸ÕëËùÖ¸ÏòµÄÖµ¡£²»¹ýÖ¸ÕëÉùÃ÷µÄÇé¿öÀýÍ⣬Èç“int *pNumber”¡£
µ½ÏÖÔÚ¶¼Ñ§µ½Ê²Ã´ÁË£¨Ò»¸öÀý×Ó£©£º
¡¡¡¡ßÝ£¡ÒªÀí½âµÄ¶«Î÷Ì«¶àÁË£¬ËùÒÔÔÚ´ËÎÒ½¨Ò飬Èç¹ûÄ㻹ÊDz»Àí½âÒÔÉϵĸÅÄîµÄ»°£¬ÄÇô×îºÃÔÙͨ¶ÁÒ»±é£»Ö¸ÕëÊÇÒ»¸ö¸´ÔÓµÄÖ÷Ì⣬ҪÕÆÎÕËüÊÇÒª»¨Ð©Ê±¼äµÄ¡£
¡¡¡¡ÕâÀïÓÐÒ»¸öʾÀý£¬½â˵ÁËÉÏÃæÌÖÂÛµÄÄÇЩ¸ÅÄî¡£ËüÊÇÓÉC±àд³É£¬²¢²»´øÓÐC++µÄÄÇЩÀ©Õ¹¡£
#include <stdio.h>
void main()
{
// ÉùÃ÷±äÁ¿£º
int nNumber;
int *pPointer;
// ÏÖÔÚ£¬¸øËüÃǸ³Öµ£º
nNumber = 15;
pPointer = &nNumber;
// ´òÓ¡nNumberµÄÖµ£º
printf("nNumber is equal to : %d\n", nNumber);
// ÏÖÔÚ£¬Í¨¹ýpPointerÀ´¿ØÖÆnNumber£º
*pPointer = 25;
// Ö¤Ã÷¾¹ýÉÏÃæµÄ´úÂëÖ®ºó£¬nNumberµÄÖµÒѾ¸Ä±äÁË£º
printf("nNumber is equal to : %d\n", nNumber);
}
¡¡¡¡Çëͨ¶Á²¢±àÒëÒÔÉÏ´úÂ룬²¢È·ÐÅÄãÒѾŪ¶®ÁËËüÊÇÈçºÎ¹¤×÷µÄ¡£È»ºó£¬µ±Äã×¼±
Ïà¹ØÎĵµ£º
ÔÚnetbeansÖбà¼C/C++ÊÇÒ»ÖÖ²»´íµÄÑ¡Ôñ£¬ÏÂÃæÎÒ¾Í˵һÏÂÕû¸öÁ÷³ÌµÄÅäÖÃ
1.ÏÈÏÂÔØMinGW
ÕâÊDZàÒëc/c++µÄ±àÒëÆ÷£¬ÔÚwindowsÏÂÖ±½ÓÒÔ.exeµÄ·½Ê½ÔËÐУ¬ÏÂÒ»²½µÄ²Ù×÷£¬Ò»Ö±µ½°²×°Íê³É¡£
2.ÏÂÔØmsys
ÕâÊǺÍMinGWͬ²½Ê¹ÓÃ
3.ÅäÖû·¾³
ÔÚÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿ÖÐÉèÖÃMinGWºÍmsysĿ¼ÖÐbinËùÔڵķ¾¶
4.²âÊÔ
ÓÃÃüÁîÐз½Ê½Ê ......
extern "C"
Ŀ¼
¸ÅÊö ±àÒ뷽ʽ Ï°¹ßÓ÷¨
¸ÅÊö
¡¡¡¡extern "C" °üº¬Ë«Öغ¬Ò壬´Ó×ÖÃæÉϼ´¿ÉµÃµ½£ºÊ×ÏÈ£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“extern”µÄ£»Æä´Î£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“C”µÄ¡£ÈÃÎÒÃÇÀ´Ïêϸ½â¶ÁÕâÁ½Öغ¬Òå¡£
¡¡¡¡£¨1£© ±»extern "C"ÏÞ¶¨µÄº¯Êý»ò±äÁ¿ÊÇexternÀàÐ͵Ä
¡¡¡¡externÊÇC/C++ÓïÑÔÖбíÃ÷º¯Ê ......
CPU : ARM9 s3c2410
LCD : ¹æ¸ñ²»Ã÷£¨Õâ¸öºÜÎÞÄΣ¬µ«ÊÇÎÒËùÖªµÀµÄÖ»ÓÐÒ»¸ö·Ö±æÂÊ£©
Ô´ÂëÐ޸ģº
/linux-2.6.30.4/arch/arm/mach-s3c2410/mach-smdk2410.c
ÔÚÕâ¸öÎļþÖмÓÈëframebufferµÄ³õʼ»¯Êý¾Ý½á¹¹£¨¾ßÌåÊý¾Ý²ÎÕÕLCD¼¼ÊõÊֲᣩÈçÏ£º
#include <mach/fb.h> ......
/////////////////////////////////////////////////
// Ö÷Ì⣺һ¶ÎÓÃÀ´ÅжÏÈÕÆÚÊÇÐÇÆÚ¼¸µÄ´úÂë
// ÃèÊö£ºÕª×Ô¡¶CCFAQ¡·
// ×÷ÕߣºÌìÖ®·ã
// ʱ¼ä£º2010-02-13
/////////////////////////////////////////////////
#include <stdio.h>
int dayofweek(int y, int m, int d) // ÅжÏÊäÈëµÄÈÕÆÚÊÇÐÇÆÚ¼¸
......
[C/C++ Digestion] –
ÖØÔزÙ×÷·û
×÷Õߣº
Jason Lee @
http://blog.csdn.net/jasonblog
ÈÕÆÚ£º
2010-04-17
[1]
ÖØÔزÙ×÷·û
ÖØÔزÙ×÷·û´Ó´óµÄ·½ÃæÀ´½²¿ÉÒÔ·ÖΪÁ½Àࣺ×îºÃ»ò±ØÐë×÷ΪÀàµÄ³ÉÔ±º¯ÊýµÄ£¬ÒÔ¼°Ïà·´¡£¶ø¾ßÌåµØ½²£¬×îºÃ»ò±ØÐë×÷ΪÀàµÄ³ÉÔ±º¯ÊýµÄÓи³Öµ²Ù×÷·û
( = )
¡¢Ï±ê²Ù×÷·û
( [] ) ......