c£¬c++·ç¸ñ×Ö´®Óëstrcmp
ÖÚËùÖÜÖª£¬strcmpΪ×Ö´®±È½ÏÖ»Ó㬼òµ¥µÄº¯Êý²¢²»¼òµ¥¡£
ÏÂÃæµÄ´úÂë
int main()
{
char* cp1 = {'z', 'h', 'a', 'n', 'g'};
char* cp2 = {'z', 'h', 'a', 'n', 'g'};
std::cout<<strcmp(cp1, cp2)<<std::endl;
return 0;
}
¿´µ½ÃüÃûÁ½¸ö×Ö·û´®ÏàµÈ£¬µ«ÊdzÌÐò¾¹È»Êä³ö-1£»
ʲôÔÒò
ÆäʵstrcmpÔڱȽϹý³ÌÖÐÈç¹û´«ÈëµÄÊÇc·ç¸ñµÄ×Ö´®ÏñÏÂÃæÕâÑù
char* cp1 = "zhang";
char* cp2 = "zhang";
ÕâÊÇʵ¼ÊÉϱȽϵÄÊÇÁ½¸ö×Ö´®µÄÊ×µØÖ·£¬¶øÕâÁ½¸ö×ÖÃ涨ÒåµÄ×Ö´®¶¼Òþº¬×ÅÀàÐÍÊÇconst
ÓÚÊÇËûÃÇÔÚÄÚ´æÖоßÓÐÏàͬµÄµØÖ·£¬ËùÒÔ¼´Ê¹±È½ÏÁ½¸öÖ¸ÕëµÄÄÚÈÝ(Á½¸ö´®µÄµØÖ·)£¬Ò²»áµÃµ½
ÕýÈ·µÄ½á¹û¡£²»¹ýÈÔÈ»ºÜ¾ªÑÈ£¬¶ÔÓÚ²»Í¬µÄ×Ö´®ÏµÍ³¾¹È»Äܹ»×¼È·¸ù¾ÝÆä´óСÔÚÄÚ´æÖÐÅÅÁÐ
ÀýÈçÉÏÃæµÄcp1ºÍcp2µØÖ·¶¼ÊÇ 0x0046b01c£»
¶øchar* cp2 = "zhou" ÕâʱµÄcp2µØÖ·½«ÊÇ0x0046b04´óÓÚÔÀ´µÄµØÖ·¡£ËùÒÔstrcmpµÄ±È
½Ï½á¹û²Å»áÓÐÕâÑùµÄ¶¨Òå¡£
¶ÔÓÚc++·ç¸ñµÄ×Ö·ûÊý×éÐÎʽÈç¹û´«ÈëµÄͬÒâÊý×éµÄÔªËصØÖ·£¬strcmp½«±È½ÏÁ½ÕßµØÖ·£¬¶ø
Èç¹û´«ÈëµÄ²»ÊÇͬһ¸öÊý×éµÄÔªËصØÖ·£¨°üÀ¨Ê×µØÖ·£©£¬½«³öÏÖ²»¿ÉÔ¤ÁϽá¹û£¬ÔÒòÊÇÕâÑùµÄ
×ö·¨²¢Îª¶¨Ò壡
//////////////////by xiaomi/////////////////////////////
/////////////////only for study /////////////////////////
//////////////////////////////////////////////////////////
Ïà¹ØÎĵµ£º
Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸еģ¬»î»î»î£¡
&n ......
The meaning of the c in calloc was vividly discussed in comp.lang.c in October 2000 (see here), with both clear (because, unlike malloc, calloc clears the memory it returns) and count (because, unlike malloc, calloc is passed a count of elements to allocate) suggested as possible explanations, howev ......
µ±¶ÁÕßÓÐÒ»¶¨c/c++»ù´¡
ÍƼöµÄÔĶÁ˳Ðò:
level 1
´Ó<<essential c++>>¿ªÊ¼£¬¶ÌС¾«º·£¬¿ÉÒÔ¶Ôc++ÄܽøÒ»²½Á˽âÆäÌØÐÔ
ÒÔ<<c++ primer>>×÷×ÖµäºÍ¿ÎÍâ¶ÁÎÒòΪ̫ºñ²»¿ÉÄÜÒ»¿ÚÆø¿´Íê
level 2
È»ºó´Ó<<effective c++>>¿ªÊ¼×ªÖ°£¬ÕâÊÇÊ¥¾£¬Çë×ñÊØ10½ë£¬Òª¾³£¿´£¬Ã»Ê¾ÍÄÃÀ´··
......
¡¡1.¸ÅÊö
¡¡¡¡Ðí¶à³õѧÕ߶ÔC/C++ÓïÑÔÖеÄvoid¼°voidÖ¸ÕëÀàÐͲ»ÉõÀí½â£¬Òò´ËÔÚʹÓÃÉϳöÏÖÁËһЩ´íÎó¡£±¾ÎĽ«¶Ôvoid¹Ø¼ü×ÖµÄÉî¿Ìº¬Òå½øÐнâ˵£¬²¢ÏêÊövoid¼°voidÖ¸ÕëÀàÐ͵ÄʹÓ÷½·¨Óë¼¼ÇÉ¡£
¡¡¡¡2.voidµÄº¬Òå
¡¡¡¡voidµÄ×ÖÃæÒâ˼ÊÇ“ÎÞÀàÐÍ”£¬void *ÔòΪ“ÎÞÀàÐÍÖ¸Õ딣¬void *¿ÉÒÔÖ¸ÏòÈκÎÀàÐ͵ÄÊý¾ ......
linuxÏÂÃæ´®¿Ú¹¤¾ßC-kermit C-kermitÊÇÒ»¿î¼¯³ÉÁËÍøÂçͨÐÅ¡¢´®¿ÚͨÐŵŤ¾ß£¬ËüÓÐÈç϶àÖÖ¹¦ÄÜ
1.Ö§³ÖkermitÎļþ´«ÊäÐÒé
2.×Ô¶¨ÒåÁËÒ»Öֽű¾ÓïÑÔ£¬ËüÇ¿´ó¶øÒ×ÓÚʹÓ㬿ÉÓÃÓÚ×Ô¶¯»¯¹¤×÷
3.ÎÞÂÛÊÇÍøÂçͨÐÅ£¬»¹ÊÇ´®¿ÚͨÐÅ£¬²Ù×÷ÊÇÒ»Öµģ¬²¢Ö§³Ö¶àÖÖÓ²¼þ¡¢Èí¼þƽ̨
4.Óа²È«ÈÏÖ¤¡¢¼ÓÃܹ¦ÄÜ
5.ÄÚ½¨FTP¡¢HTTP¿Í»§¶Ë¹ ......