C¿âº¯Êý×Ö·û´®´¦Àíº¯ÊýµÄCʵÏÖ(³£¼û)
1.strlen()
ʵÏÖ£º
size_t strlen(const char *s)
{
size_t n;
for(n = 0; *s != '\0'; s++)
++n;
return n;
}
2.strcpy()
ʵÏÖ;
char *strcpy(char *s1, register const char *s2)
{
register const char *p = s1;
while(*p++ = *s2++)
;
return s1;
}
·ÖÎö;
Õâ¸öwhileÑ»·ÊǸö¿ÕÑ»·£¬ËùÓеĶ¯×÷¶¼ÊÇ×÷ΪwhileÑ»·µÄ¿ØÖƱí´ïʽµÄ¸±×÷ÓÃÍê³ÉµÄ¡£
while(*p++ = *s2++)£¬pËùÖ¸ÏòµÄ×Ö·û±»¸³ÖµÎªs2ËùÖ¸ÏòµÄ×Ö·û£¬È»ºópºÍs2¶¼½øÐÐÔöÖµ£¬Ö¸ÏòÏÂÒ»¸ö×Ö·û£¬ÖªµÀs2Ö¸ÏòµÄ×Ö·ûÊÇ'\0'£¨ÆäֵΪ0£©¡£µ±Õâ¸ö0¸³¸øpËùÖ¸ÏòµÄ×Ö·ûʱ£¬Ï൱ÓÚÉèÖÃÁË×Ö·û´®½áÊø±êÖ¾£¬²¢ÇÒÕû¸ö±í´ïʽµÄֵΪ0£¬Í˳öÑ»·¡£
ËùÓвÙ×÷µÄЧ¹ûÊÇ°Ñ×Ö·û´®s2¸´ÖƸøs1¡£
3.strcat()
ʵÏÖ£º
char *strcat(char *s1, register const char *s2)
{
register char *p =s1;
while(*p)
++p;
while(*p++ = *s2++)
;
return s1;
}
·ÖÎö;
ʹÓÃregister´æ´¢ÀàÐÍÊÇΪÁË»ñµÃ×î¿ìµÄÖ´ÐÐËٶȡ£
Ïà¹ØÎĵµ£º
½âÌâ˼·£º Õâ¸öÍøÂçÉÏÒѾÓкܶà´ð°¸£¬ÕâÀï
ÁоÙÒ»¸ö¸´ÔÓ¶ÈΪ0(m*n)µÄÀý×Ó¡£ÊµÏÖµÄÔÀí
ºÜ¼òµ¥£¬Ë³Ðò±éÀúÒª²éÕÒµÄ×Ö·û´®£¬Èç¹ûûÓÐÕÒ
µ½£¬×Ö·û´®Ö¸ÕëÍùǰһ룬ÔÙÍùºó±È½ÏÒª²éÕÒµÄ
×Ö·û´®£¨Ä£Ê½´®£©£¬ÈçÏÂͼËùʾ£º
a b c d d d a d a c a b d a d d d a d c k
&nbs ......
¡¾ÔÐÍ¡¿
printf("<¸ñʽ»¯×Ö·û´®>
", <²ÎÁ¿±í>
);
int printf
(const char *format, ...);
int fprintf
(FILE *stream, const char *format, ...);
int sprintf
(char *str, const char *format, ...);
int snprintf
(char *str, size_t size, const char *format, ...);
vp ......
BSÓëCSµÄÁªÏµÓëÇø±ð[ת]
5
ÍƼö
javaÊʺϿª·¢bs½á¹¹£¬cs²»ÊÇËüµÄÇ¿Ïî.
C/SÊÇClient/ServerµÄËõд¡£·þÎñÆ÷ͨ³£²ÉÓøßÐÔÄܵÄPC¡¢¹¤×÷Õ¾»òСÐÍ»ú£¬²¢²ÉÓôóÐÍÊý¾Ý¿âϵͳ£¬ÈçOracle¡¢Sybase¡¢Informix»ò SQL Server¡£¿Í»§¶ËÐèÒª°²×°×¨ÓõĿͻ§¶ËÈí¼þ¡£
B/SÊÇBrower/ServerµÄËõд£¬¿Í»§»úÉÏÖ»Òª°²×°Ò»¸öä¯ÀÀÆ÷£¨Browser£© ......
¡¡¡¡ÒýÑÔ
¡¡¡¡Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉ ......