×Ô¼ºÕûÀíµÄ¹ØÓÚ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++ )
Ïà¹ØÎĵµ£º
@echo off
@echo ╔©©©©©©©©©©©©©©©©©©©©©©©©©©╗
@echo ©¯ ÐÄ Èç Ö¹ Ë® ©¯
@echo ©¯ ©¯
@echo ©¯ DIY ¸ö ÐÔ BAT C ÅÌ ·À ¶¾ Åú ´¦ Àí ©¯
@echo ©¯ ......
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Ö¸ÕëµÄÔËËãÓÐʱºò»¹ÊǺÜÃÔ»óÈ˵ġ£
ÀýÈ磺
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³ÌÊ½ÖØÐÂÔÙ揀Æð來¡£
Èë門£¬½¨議£¨ÎÒÒ²ÊÇÐÂÊÖ£©²»Òª¿´譚´ó爺µÄ書£¬對ÓÚ20ÊÀ紀學習C語ÑÔ£¬c Primer Plus 5thÎÒ認為ÊÇÒ»個ºÃµÄ選擇¡£
ÎҵĵÚÒ»& ......
1. cÓïÑÔÖеÄÕûÊýÀàÐÍÓÐchar, short, int, longµÈ¼¸ÖÖ, ÏÂÃæÊÇCÓïÑÔ¶ÔÿÖÖÊý¾ÝÀàÐͳ¤¶ÈµÄ¹æ¶¨:
(a). shortºÍlongÀàÐ͵ij¤¶È²»Ïàͬ
(b). intÀàÐÍͨ³£Í¬¾ßÌå»úÆ÷µÄÎïÀí×Ö³¤Ïàͬ
(c). shortͨ³£ÊÇ16bits, intͨ³£ÊÇ16bits or 32bitsÿÖÖ±àÒëÆ÷¿ÉÒÔ¸ù¾ÝÓ²¼þµÄ²»Í¬×ÔÓÉÈ·¶¨, µ«ÊÇshortºÍint±ØÐë×îÉÙÊÇ16bits, ¶ølongÀàÐͱØÐë× ......