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

ÎÒµÄCʵ¼ù(1)£ººêµÄÓ¦ÓÃ

    1¡¢ÎªÁ˵÷ÓúêʱÄܵõ½ÕýÈ·½á¹û£¬ÔÚºêÌåÖн¨Òé¶ÔºêµÄÿ¸ö²ÎÊýÓÃÀ¨ºÅÀ¨ÆðÀ´£¬²¢ÇÒµ±ºêÌåÊÇÒ»¸ö±í´ïʽʱÕû¸öºêÌåÒ²ÓÃÀ¨ºÅÀ¨ÆðÀ´¡£
/* c1.c£º½«Á½¸öÊýÏà³Ë */
#define product(x,y) ((x)*(y))
#include <stdio.h>
int main(){
int a=1,b=2,c=3,d=4,x=0;

x=product(a+3,b)+product(c,d); /* ÈôºêÌåÖÐûÓÐʹÓÃÀ¨ºÅ£¬ÔòµÃ²»µ½
ÄãÏëÒªµÄ½á¹û */
printf("%d\n",x);
return 0;
}

    2¡¢ÓúêÀ´²åÈëÈÎÒâÓï¾ä¡£
/* c2.c£º²åÈëÈÎÒâÓï¾ä */
#define insert(stmt) stmt /* ²åÈëÈÎÒâÓï¾ä */
#include <stdio.h>
int main(){
int a,b;
insert({ a=1;b=1; }) /* ÕâÊÇÒ»¸ö¸´ºÏÓï¾ä */
insert({ a=1,b=1; }) /* Èç¹û¶ººÅ±í´ïʽ²»ÓÃÔ²À¨ºÅÀ¨Æð£¬ÔòÔ¤´¦ÀíÆ÷»áÈÏΪ
ÓÐÁ½¸öʵ²Î£¬±¨´í */
printf("a=%d, b=%d\n",a,b);
return 0;
}


    ×¢Ò⣬µÚ2¸öµ÷ÓÃÖжººÅ±í´ïʽÓï¾äÒªÓÃÀ¨ºÅÀ¨ÆðÀ´£¬·ñÔòÔ¤´¦ÀíÆ÷»áÈÏΪ¸øºê´«ÁËÁ½¸öʵ²Î£¬ÓÉÓÚûÓÐÁ½¸öʵ²ÎµÄincr£¬Òò´Ë»á±¨´í¡£
    3¡¢ÎªÁËʹº¯ÊýʽºêÄÜÏñÕæÕýµÄº¯ÊýÒ»Ñù¹¤×÷£¬½¨ÒéÓÃdo{  }while(0)Óï¾ä°üסºêÌåµÄ´úÂë¡£
/* c3.c£º ½»»»Á½¸öÕûÐͱäÁ¿µÄÖµ */
/* #define swap(x,y) { int temp=x; x=y; y=temp; } */
#define swap(x,y) \
do { int temp=x; x=y; y=temp; } while(0)
#include <stdio.h>
int main(){
int x=4,y=3;
if(x>y) swap(x,y); /* ÓõÚÒ»¸öswapʱ»á³ö´í£¬µ¼ÖÂ{ }ºóÃæÓÐÒ»¸ö·ÖºÅ£¬
Óõڶþ¸öswapÔòûÎÊÌâ */
else x=y;
printf("x=%d, y=%d\n",x,y);
return 0;
}

    Èç¹ûÓÃ×¢ÊÍÖж¨ÒåÄǸöswap£¬Ôòif {...};ºóÃæ»áÒ»¸ö·ÖºÅ£¬µ¥¶ÀµÄ·ÖºÅÊÇÒ»¸ö¿ÕÓï¾ä£¬Õâµ¼ÖÂifÓëelseÖ®¼äÓÐÁ½¸öµ¥¶ÀµÄÓï¾ä²»ºÏ·¨¡£¶øÓÃdo{ }while(0)Ì×סÓï¾äʱÔò²»»áÓÐÕâÑùµÄÎÊÌâ¡£
    4¡¢ÓúêÀ´°ü×°Óï¾ä¡£
/* c4.c£º´òÓ¡1µ½20µÄÁ¢·½±í£¬ÓúêÀ´°ü×°Ñ­»·Óï¾ä */
#define incr(v,low,high) \
for((v)=(low); (v)<=(high); (v)++)
#include <stdio.h>
int main(){
int j;
incr(j,1,20)
printf("%2d %6d\n",j,j*j*j);
return 0;


Ïà¹ØÎĵµ£º

Xen Demo C

   ¶ÔÓÚxenµÄÐéÄ⻯¹ÜÀí£¬´ó¼Ò¶¼ÔÚÓÃʲôÄØ£¿ÎÒÕæµÄÏëÖªµÀÊDz»ÊÇ´ó¼Ò¶¼ÓÃxmÀ´½øÐйÜÀíÄØ£¿ÖÁÉÙÎÒÏë´ó¶àÊý½ö½öÏëÁ˽âһϵÄÅóÓÑ¿ÉÄÜÓÃÏÂxmÒ²¾ÍËãÊÇÁ˽âÁË¡£¶øÇÒÔÚxenµÄÓû§ÊÖ²áÀïÃæÒ²½ö½ö½éÉÜÁËÒ»ÏÂxmµÄʹÓ÷½·¨£¬¹ØÓÚÔõôʹÓÃËüµÄc½Ó¿ÚÀ´¹ÜÀíÐéÄ⻯·½ÃæµÄ½éÉÜÖ»×ÖδÌá¡£
   ÎÒ²»½ö½öÏëÓÃxmÕâ¸ö¹¤¾ßÀ´´ ......

»ñÈ¡IPµÄC ´úÂë

»ñÈ¡IPµÄC ´úÂë #include<stdio.h> #include<winsock2.h> #pragma comment(lib,"ws2_32.lib") void CheckIP(void) //¶¨ÒåCheckIP£¨£©º¯Êý£¬ÓÃÓÚ»ñÈ¡±¾»úIPµØÖ· { WSADATA wsaData; char name[255]; //¶¨ÒåÓà ...
»ñÈ¡IPµÄC ´úÂë
#include<stdio.h>
#include<winsock2.h>
#pragma comment(li ......

cÖÐÄÚ´æ·Ö²¼

¶ÑºÍÕ»µÄÇø±ð
Ò»¡¢Ô¤±¸ÖªÊ¶—³ÌÐòµÄÄÚ´æ·ÖÅä
Ò»¸öÓÉc/C++±àÒëµÄ³ÌÐòÕ¼ÓõÄÄÚ´æ·ÖΪÒÔϼ¸¸ö²¿·Ö
1¡¢Õ»Çø£¨stack£©— ÓɱàÒëÆ÷×Ô¶¯·ÖÅäÊÍ·Å £¬´æ·Åº¯ÊýµÄ²ÎÊýÖµ£¬¾Ö²¿±äÁ¿µÄÖµµÈ¡£Æä²Ù×÷·½Ê½ÀàËÆÓÚÊý¾Ý½á¹¹ÖеÄÕ»¡£
2¡¢¶ÑÇø£¨heap£©— Ò»°ãÓɳÌÐòÔ±·ÖÅäÊÍ·Å£¬ Èô³ÌÐòÔ±²»ÊÍ·Å£¬³ÌÐò½áÊøʱ¿ÉÄÜÓÉOS»ØÊÕ ¡£ ......

C/C++ÕÐƸµÄһЩ¸ÐÊܺ;­Ñé

C/C++ÕÐƸµÄһЩ¸ÐÊܺ;­Ñé
Ç°¶Îʱ¼ä¸Õ²Î¼ÓÁËn¶à¹«Ë¾µÄC/C++Èí¼þ¹¤³ÌʦµÄÃæÊÔ£¬ÓйúÆó£¬ÍâÆó£¬Ë½Æó£¨moto£¬·É˼¿¨¶û£¬¸ÛÍ壬ÖйúÎÀÐÇXXX£¨Õâ¸öÅ££©£©µÈµÈµÈµÈ¡£¸ÐÊܸÐÏëÆĶ࣬½üÈÕÖÕÓÚ¿ÕÏУ¬Ôڴ˱íÊöһϡ£
±¾ÈË»ù±¾Ìõ¼þ£º3Ä꿪·¢¾­Ñ飬2year+ Windows development experence£¬1year+ Linux experence. ÊìϤC£¬C++£¬MFC/ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ