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

×Ô¼ºÕûÀíµÄ¹ØÓÚCµÄһЩ×Ö·û´®´¦Àíº¯Êý

¼øÓÚÔÚÓÃCÓïÑÔдһЩ×Ö·û´®´¦ÀíµÄ³ÌÐòʱÖÖÖֵIJ»±ã,±¾È˼áÐÅ"Ä¥µ¶²»Îó¿³²ñ¹¦"Õâ¸öÐÅÌõ,ÓÚÊÇÔÚרÃÅ
½øÐÐÁËÒ»´ÎÄ¥¶ÔCÓïÑÔµÄÄ¥µ¶,дÁËһЩ×Ö·û´®µÄ´¦Àíº¯Êý, ·½±ãÍøÓÑʹÓÃ, ´ó¼ÒÓкõĽâ¾ö·½·¨Ò²Çë¸æÖªÒ»ÏÂ.
¡¡¡¡¡¡¡¡ÎÒ¹À¼ÆÓÐһЩCµÄ¿âÖп϶¨ÓбÈÎÒÕâ¸üºÃµÄº¯Êý, µ«ÊDZ¾ÈËûÓÐÕÒµ½, Íû"ÐмÒ"¸æÖª.
#include <string.h>
/********************************************************
    ·µ»Ø×Ö·ûchÔÚhead×Ö·û´®ÖÐÊ״γöÏÖµÄλÖÃ
********************************************************/
int indexString(char* head, char ch)
{
    int i=0;
    int flag=0;
    while(head[i]!=0)
    {
        if(head[i] == ch)
        {
            flag=1;
            break;
        }
        i++;
    }
    if(flag)
        return i;
    else
        return -1;
}
/********************************************************
    Çó×Ó×Ö·û´®µÄº¯Êý£ºÈ¡×Ö·û´®headÖдÓstartλÖõ½end
    λÖô¦µÄ×Ö·û´®£¬Èçhead="hello world xphag",
    subString(head, 0, strlen(head)-1)µÄ½á¹ûΪ"hello world xphag"
    subString(head, 0, 0)µÄ½á¹ûΪ"h"
********************************************************/
char* subString(char* head, int start, int end)//È¡×Ö·û´®µÄstartλÖõ½endλÖõÄ×Ó×Ö·û´®(º¬start),ʧ°Ü·µ»ØNULL
{
    int i=0, j=0;
    i=strlen(head);
    if(start>=i || end>= i || start> end)
        return NULL;
    char* p=(char* )malloc(sizeof(char)* (end-start+2));
    for(i=start; i<=end; i++ )


Ïà¹ØÎĵµ£º

Optimizing Your C/C++ Applications


C/C++ optimizing compilers are great--but there *are* a few techniques for hand-tuning your code to run as efficiently as possible on the AMD Athlon64 and Opteron processors, especially when developing DLLs, device drivers, or other performance-bound pieces of code.
Alan Zeichick  
Share | ......

C/SģʽÓëB/SģʽµÄ±È½Ï·ÖÎö

Ò»¡¢C/SģʽÓëB/SģʽµÄ±È½Ï·ÖÎö
¡¡¡¡C/SģʽÖ÷ÒªÓÉ¿Í»§Ó¦ÓóÌÐò(Client)¡¢·þÎñÆ÷¹ÜÀí³ÌÐò(Server)ºÍÖмä¼þ(middleware)Èý¸ö²¿¼þ×é³É¡£¿Í»§Ó¦ÓóÌÐòÊÇϵͳÖÐÓû§ÓëÊý¾Ý½øÐн»»¥µÄ²¿¼þ¡£·þÎñÆ÷³ÌÐò¸ºÔðÓÐЧµØ¹ÜÀíϵͳ×ÊÔ´£¬Èç¹ÜÀíÒ»¸öÐÅÏ¢Êý¾Ý¿â£¬ÆäÖ÷Òª¹¤×÷Êǵ±¶à¸ö¿Í»§²¢·¢µØÇëÇó·þÎñÆ÷ÉϵÄÏàͬ×ÊԴʱ£¬¶ÔÕâЩ×ÊÔ´½øÐÐ×î ......

cÖ¸Õë

cÖ¸ÕëµÄÔËËãÓÐʱºò»¹ÊǺÜÃÔ»óÈ˵ġ£
ÀýÈ磺
struct student {
int num;
int score;
int length;
};
struct student *pt;
pt = (struct student *) malloc(sizeof(struct student));
pt->num = 1;
pt->score = 90;
pt->length = 3 * sizeof(int);
printf("pt length:%d\n", *pt);
pt = (int ......

C/C++Êý¾ÝÀàÐÍ(ÍøÉÏ×ÊÁÏ×ܽá)

1. cÓïÑÔÖеÄÕûÊýÀàÐÍÓÐchar, short, int, longµÈ¼¸ÖÖ, ÏÂÃæÊÇCÓïÑÔ¶ÔÿÖÖÊý¾ÝÀàÐͳ¤¶ÈµÄ¹æ¶¨:
(a). shortºÍlongÀàÐ͵ij¤¶È²»Ïàͬ
(b). intÀàÐÍͨ³£Í¬¾ßÌå»úÆ÷µÄÎïÀí×Ö³¤Ïàͬ
(c). shortͨ³£ÊÇ16bits, intͨ³£ÊÇ16bits or 32bitsÿÖÖ±àÒëÆ÷¿ÉÒÔ¸ù¾ÝÓ²¼þµÄ²»Í¬×ÔÓÉÈ·¶¨, µ«ÊÇshortºÍint±ØÐë×îÉÙÊÇ16bits, ¶ølongÀàÐͱØÐë× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ