C/C++Êý×éÃûÓëÖ¸ÕëÇø±ðÉî²ã̽Ë÷
×÷ÕߣºËᦻª e-mail:21cnbao@21cn.com
1. ÒýÑÔ
Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º“Êý×éÃû¾ÍÊÇÖ¸Õ딡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí±ß»¹Ò»Ö±³äÂúÕâÑùµÄ³ÌÐòÔ±£¬ËûÃDZ£Áô×Å“Êý×éÃû¾ÍÊÇÖ¸Õ딵ÄÎó½â¡£
Ïë±ØÕâÖÖÎó½âµÄ¸ùÔ´ÔÚÓÚ¹úÄÚijÖøÃûµÄC³ÌÐòÉè¼Æ½Ì³Ì¡£Èç¹ûÕâƪÎÄÕÂÄܹ»¾ÀÕýÐí¶àÖйú³ÌÐòÔ±¶ÔÊý×éÃûºÍÖ¸ÕëµÄÎó½â£¬±ÊÕ߾Ͳ»ÉõÐÀοÁË¡£½è´ËÎÄ£¬±ÊÕßÕ¾ÔÚÎÞÊý¶Ô֪ʶÈç¼¢ËƿʵÄÖйú³ÌÐòÔ±Ö®ÖУ¬ÉîÉî¼ÄÏ£ÍûÓÚ¹úÄڵļÆËã»úͼÊé±àдÕßÃÇ£¬ÄÜÒÔ“ÉîÈë̽Ë÷”µÄ˼ά·½Ê½ºÍ¾«ÒæÇ󾫵ÄÈÏÕæ̬¶ÈÀ´¶Ô´ýͼÊé±àд¹¤×÷£¬µ«Ô¸ÊÐÃæÉ϶àһЩÈÚÈë×÷Õß˼¿¼½á¾§µÄÐÄѪ֮×÷£¡
2. ħ»ÃÊý×éÃû
Çë¿´³ÌÐò£¨±¾ÎijÌÐòÔÚWIN32ƽ̨ϱàÒ룩£º
1. #include <iostream.h>
2. int main(int argc, char* argv[])
3. {
4. char str[10];
5. char *pStr = str;
6. cout << sizeof(str) << endl;
7. cout << sizeof(pStr) << endl;
8. return 0;
9. }
2.1Êý×éÃû²»ÊÇÖ¸Õë
ÎÒÃÇÏÈÀ´ÍÆ·“Êý×éÃû¾ÍÊÇÖ¸Õ딵Ä˵·¨£¬Ó÷´Ö¤·¨¡£
Ö¤Ã÷¡¡Êý×éÃû²»ÊÇÖ¸Õë
¼ÙÉ裺Êý×éÃûÊÇÖ¸Õ룻
Ôò£ºpStrºÍstr¶¼ÊÇÖ¸Õ룻
ÒòΪ£ºÔÚWIN32ƽ̨Ï£¬Ö¸Õ볤¶ÈΪ4£»
ËùÒÔ£ºµÚ6Ðк͵Ú7ÐеÄÊä³ö¶¼Ó¦¸ÃΪ4£»
ʵ¼ÊÇé¿öÊÇ£ºµÚ6ÐÐÊä³ö10£¬µÚ7ÐÐÊä³ö4£»
ËùÒÔ£º¼ÙÉè²»³ÉÁ¢£¬Êý×éÃû²»ÊÇÖ¸Õë
2.2 Êý×éÃûÉñËÆÖ¸Õë
ÉÏÃæÎÒÃÇÒѾ֤Ã÷ÁËÊý×éÃûµÄÈ·²»ÊÇÖ¸Õ룬µ«ÊÇÎÒÃÇÔÙ¿´¿´³ÌÐòµÄµÚ5ÐС£¸ÃÐгÌÐò½«Êý×éÃûÖ±½Ó¸³Öµ¸øÖ¸Õ룬ÕâÏÔµÃÊý×éÃûÓÖµÄÈ·ÊǸöÖ¸Õ룡
ÎÒÃÇ»¹¿ÉÒÔ·¢ÏÖÊý×éÃûÏÔµÃÏñÖ¸ÕëµÄÀý×Ó£º
1. #include <string.h>
2. #include <iostream.h>
3. int main(int argc, char* argv[])
4. {
5. char str1[10] = "I Love U";
6. char str2[10];
7. strcpy(str2,str1);
8. cout << "string array 1:
Ïà¹ØÎĵµ£º
ÊÕ¼¯ÁË¿´Ò»ÏÂC/C++±ê×¼¿âʹÓõÄÏà¹ØÍøÕ¾£º
GNU¹ÙÍø£º
http://www.gnu.org/
¸ÃÍøÕ¾°üº¬C/C++±ê×¼¿âµÄʹÓ÷¶Àý£¬ÖµµÃ²Î¿¼£º
http://www.cplusplus.com/
ÔÚǶÈëʽµÚÈý·½Èí¼þÒÆֲʱ£¬»áʹÓÃSTLÄ£°å¿â×÷ÏàÓ¦ÒÆÖ²£¬ÈçAndroidƽ̨JNI·â×°¼°ÒÆÖ²µÈ¡£
¸ÃÍøÕ¾½éÉÜstlportµÄʹÓã¬stlportÒѿɳɹ¦ÒÆÖ²ÖÁAndroidµÈǶÈëʽƽ̨£¬²¢Ç ......
CÓïÑԵijõѧÕß³£·¸µÄÒ»¸öʧÎóÊǵ÷ÓÃϵͳ»òµÚÈý·½APIʱÍüÁËÔÚº¯ÊýÉùÃ÷Öбê×¢WINAPIµ÷Ó÷½Ê½£¬¶ø²ËÄñC++³ÌÐòԱҲÿÿÀ§»óΪʲô³ÉÔ±º¯Êý±ØÐëָʾΪCALLBACKÔÙÌí¼Óstatic¹Ø¼ü×Ö²ÅÄÜ×÷Ϊ»Øµ÷º¯Êý¡£ÔÚx86ϵͳÖУ¬´æÔÚ¶àÖÖº¯Êýµ÷ÓÃÔ¼¶¨¡£Èç¹ûµ÷ÓÃÕßÓë±»µ÷ÓÃÕß²ÉÓò»Í¬µÄµ÷ÓÃÔ¼¶¨£¬ºÜ¿ÉÄܵ¼Ö¶ÑÕ»ÆÆ»µ¡¢·Ç·¨·ÃÎʵÈÖÂÃü´íÎó¡£
ҲР......
1.´óβ(big_endian)Сβ(little_endian)µÄÎÊÌâ
»ùÓÚWebµÄ²âÊÔÈí¼þÊÇÓÉC++Êý¾Ý²É¼¯·þÎñÆ÷³ÌÐòºÍ¿Í»§¶ËJavaÏÔʾ³ÌÐòÁ½²¿·Ö¹¹³É£¬Ç°ÕßÓÃC++£¬ºóÕßJavaÓïÑÔ£¬´æÔÚÊý¾ÝÒÆÖ²ÎÊÌâ¡£ÒòΪ
ÔÚ¼ÆËã»úϵͳÖУ¬µ±°üº¬Êý×ֵĶþ½øÖÆÎļþ´ÓÒ»¸ö½á¹¹ÒƵ½ÁíÒ»½á¹¹Ê±£¬¾Í³öÏÖ´óβСβÎÊÌâ¡£²»Í¬CPUÔÚ¶à×Ö½ÚÊý£¨ÈçËÄ×Ö½Úint£©´æ´¢Ê±ÓÐÁ½ÖÖ·½·¨ ......
1 Ñ¡Ôñnew->project->win32 console project£»
ÔÚÕâÒ»²½µÄÑ¡¿òÉÏÓÐÒ»¸öÑ¡ÏîÊÇ create dictionary for solution, ÎÒ²»ÖªµÀÕâ¸ö¾ßÌåÊÇʲô×÷Óã¬Ñ¡ÁËÖ®ºó»áÏîÄ¿³öÏÖÁ½²ãÎļþ¼Ð£¬±ÈÈçÄã´´½¨Ò»¸öÃüÃûΪtestµÄÏîÄ¿£¬»áÉú³ÉtestÎļþ¼Ð£¬testÖаüº¬ÁíÒ»¸ötestÎļþ¼Ð£¬ÄãµÄÏîĿʵ¼ÊÉÏ·ÅÔÚÁËÄÚ²ãte ......