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

[ÊÕ²Ø]C/C++Êý×éÃûÓëÖ¸ÕëÇø±ðÉî²ã̽Ë÷

¸ù±¾Ô­ÒòÔÚÓë×óÖµºÍÓÒÖµ
char a[10]=“hello”;
sizeof(a);//Êý×éÃû×ö×óÖµ£¬¾ßÓÐÊý×éÃûµÄÊôÐÔ£¬ÊÇÒ»¸öÖ¸ÏòÊý×éÊ×µØÖ·µÄ³£Á¿Ö¸Õë
strcpy(a,"abc");//Êý×éÃû×öÓÒÖµ£¬ÍË»¯ÎªÆÕͨµÄÖ¸Õë
Ô­ÎÄÁ´½Ó£º
 http://hi.baidu.com/%D2%C0%BD%A3%D0%F9/blog/item/7bbf36966c92f36a54fb9663.html
×÷ÕߣºËᦻª 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 ÐС£¸ÃÐгÌÐò½«Êý×éÃûÖ±½Ó¸³Öµ¸øÖ¸Õ룬ÕâÏÔ
61
µÃÊý×éÃûÓÖµÄÈ·ÊǸöÖ¸Õ룡
ÎÒÃÇ»¹¿ÉÒÔ·¢ÏÖÊý×éÃûÏÔµÃÏñÖ¸ÕëµÄÀý×Ó£º
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(s


Ïà¹ØÎĵµ£º

CÖ¸ÕëС½á

1¡¢¶þάָÕëµÄÓ÷¨ËµÃ÷
a[i]´ÓÐÎʽÉÏ¿´ÊÇaÊý×éÖеĵÚi¸öÔªËØ¡£
Èç¹ûaÊÇһάÊý×飬Ôòa[i]´ú±íaÊý×éµÚi¸öÔªËØËùÕ¼µÄÄÚ´æµ¥ÔªµÄÄÚÈÝ¡£a[i]ÊÇÓÐÎïÀíµØÖ·µÄ£¬ÊÇÕ¼ÄÚ´æµ¥ÔªµÄ¡£
µ«Èç¹ûaÊǶþάÊý×飬Ôòa[i]ÊÇ´ú±íһάÊý×éÃû¡£ËüÖ»ÊÇÒ»¸öµØÖ·£¨ÈçͬһάÊý×éÃûÖ»ÊÇÒ»¸öÖ¸Õë³£Á¿Ò»Ñù£©¡£a£¬a+i£¬a[i], *(a+i), *(a+i)+j, a[i]+j¶¼Ê ......

¡¾×ª¡¿cÅжϴó¶ËС¶Ëģʽ

ÊÔÌâ1£ºÇëдһ¸öCº¯Êý£¬Èô´¦ÀíÆ÷ÊÇBig_endianµÄ£¬Ôò·µ»Ø0£»ÈôÊÇLittle_endianµÄ£¬Ôò·µ»Ø1
½â´ð£º
int checkCPU( )
{
    {
           union w
           {  
  &n ......

C/C++³ÌÐòԱӦƸÊÔÌâÆÊÎö


1.ÒýÑÔ
¡¡¡¡±¾ÎĵÄд×÷Ä¿µÄ²¢²»ÔÚÓÚÌṩC/C++³ÌÐòÔ±ÇóÖ°ÃæÊÔÖ¸µ¼£¬¶øÖ¼ÔÚ´Ó¼¼ÊõÉÏ·ÖÎöÃæÊÔÌâµÄÄÚº­¡£ÎÄÖеĴó¶àÊýÃæÊÔÌâÀ´×Ô¸÷´óÂÛ̳£¬²¿·ÖÊÔÌâ½â´ðÒ²²Î¿¼ÁËÍøÓѵÄÒâ¼û¡£
¡¡¡¡Ðí¶àÃæÊÔÌâ¿´ËƼòµ¥£¬È´ÐèÒªÉîºñµÄ»ù±¾¹¦²ÅÄܸø³öÍêÃÀµÄ½â´ð¡£ÆóÒµÒªÇóÃæÊÔÕßдһ¸ö×î¼òµ¥µÄstrcpyº¯Êý¶¼¿É¿´³öÃæÊÔÕßÔÚ¼¼ÊõÉϾ¿¾¹´ïµ½ÁËÔõÑù ......

²»¿ÉС¿´µÄextern "C"

     ÏîÄ¿ÖÐÒªÓõ½Ò»¸öÄ£¿é¡£¿´ÁËϸÃÄ£¿éµÄÓ÷¨£¬¾ÍÒÀºù«»­Æ°µÄ°áµ½×Ô¼ºµÄ´úÂëÀïÃæÀ´ÁË¡£²»¹ýÔÚ±àÒëµÄʱºòÅöµ½ÁËÂé·³£¬ ÔÚ³ÌÐòÁ´½ÓµÄʱºò³ö´í£º“undefined reference to***",Ó¦¸ÃÊÇÒòΪûÓаüº¬ÏàÓ¦µÄ¿âÎļþ°É¡£
      ÓÚÊDZȽÏÁËmake fileÎļþµÄд·¨£¬ÊÔͼÔÚÎÒÕâ±ß ......

doxygen+VIMÎĵµÊµÓÃÖ¸ÄÏfor C/C

ͻ񻣼
Îĵµ×«Ð´ÊÇÒ»ÏîÊ®·Ö·±Ëö¶øÇÒ·ÑÁ¦µÄ¹¤×÷£¬ÏàÐÅÒѾ­ÓкܶàÈ˶ԴËÉî¸ÐÍ·Í´¡£ÎĵµÉú³É¹¤¾ßµÄ³öÏÖ×î´óÏ޶ȵذïÖú³ÌÐòÔ±½â¾öÁËÕâ¸öÎÊÌ⣬ÕâЩ¹¤¾ßͨ³£¿ÉÒÔ´Ó³ÌÐòÔ´´úÂë×Ô¶¯Éú³ÉÎĵµ£¬´ó´ó·½±ãÁËÎĵµ¹¤×÷¡£ÕâƪС¶«Î÷Ö÷Òª½éÉÜÁËÈçºÎÓÃVIMºÍdoxygenÀ´¿ìËÙÉú³É×¢ÊÍ£¬²¢ÓÃ×îÉٵĶîÍâÀͶ¯À´Íê³Éרҵˮ׼µÄ³ÌÐòÎĵµµÄ¹ý³Ì¡£½ö¹© ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ