ѸÀ×±ÊÊÔ ×Ö·û´®·´×ª C¿âº¯Êý strrev
char* my_strrev( char* string )
{
char *left, *right, ch;
left = right = string;
while( *right++ != '\0');
right -= 2;
while( left<right )
{
ch = *left;
*left = *right;
*right = ch;
++left; --right;
}
return string;
}
// ²âÊÔ´úÂë
int _tmain( int argc, TCHAR* argv[] )
{
char szBuf[10] = {0};
strcpy_s( szBuf, "hello" );
printf( "%s", my_strrev(szBuf) );
system( "pause" );
return 0;
}
Ïà¹ØÎĵµ£º
Ò». ÔÚcÖзÖΪÕ⼸¸ö´æ´¢Çø
1.Õ» - ÓɱàÒëÆ÷×Ô¶¯·ÖÅäÊÍ·Å
2.¶Ñ - Ò»°ãÓɳÌÐòÔ±·ÖÅäÊÍ·Å£¬Èô³ÌÐòÔ±²»ÊÍ·Å£¬³ÌÐò½áÊøʱ¿ÉÄÜÓÉOS»ØÊÕ
3.È«¾ÖÇø£¨¾²Ì¬Çø£©£¬È«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿µÄ´æ´¢ÊÇ·ÅÔÚÒ»¿éµÄ£¬³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿ÔÚÒ»¿éÇøÓò£¬Î´³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍδ³õʼ»¯µÄ¾²Ì¬±äÁ¿ÔÚÏàÁÚµÄÁíÒ»¿éÇøÓò¡£- ³ÌÐò½áÊøÊÍ·Å
4.Á ......
CÖеÄCONST¡¡¡¡
CÖÐCONSTµÄʹÓãº
¡¡¡¡constÊÇÒ»¸öCÓïÑԵĹؼü×Ö£¬ËüÏÞ¶¨Ò»¸ö±äÁ¿²»ÔÊÐí±»¸Ä±ä¡£Ê¹ÓÃconstÔÚÒ»¶¨³Ì¶ÈÉÏ¿ÉÒÔÌá¸ß³ÌÐòµÄ°²È«ÐԺͿɿ¿ÐÔ£¬ÁíÍ⣬ÔÚ¹Û¿´±ðÈË´úÂëµÄʱºò£¬ÇåÎúÀí½âconstËùÆðµÄ×÷Ó㬶ÔÀí½â¶Ô·½µÄ³ÌÐòÒ²ÓÐһЩ°ïÖú¡£
¡¡¡¡ËäÈ»ÕâÌýÆðÀ´ºÜ¼òµ¥£¬µ«Êµ¼ÊÉÏ£¬constµÄʹÓÃÒ²ÊÇcÓïÑÔÖÐÒ»¸ö±È½Ï΢ÃîµÄµØ ......
¿¼²éÒ»¸ö³õ¼¶Ç¶Èëʽϵͳ¿ª·¢ÈËÔ±µÄC»ù±¾¹¦£¬¸½Óдð°¸ÌâÄ¿ÓÉ×ÊÉîǶÈëʽϵͳר¼ÒÄⶨ,Ä¿µÄÊÇ¿¼²éÈëÃż¶µÄǶÈëʽÈí¼þ¿ª·¢ÈËÔ± Gavin ShawÌṩÏêϸ½â´ð
±àÕß°´:·Ç³£»ù±¾¹ØÓÚCÓïÑÔµÄÎÊÌâ,Ò»¸öÐÅÏ¢Àà(¼ÆËã»ú,×ÊѶ¹¤³Ì,µç×Ó¹¤³Ì, ͨÐŹ¤³Ì)רҵµÄ±¾¿Æ±ÏÒµÉúÓ¦¸Ã´ïµ½µÄˮƽ¡£ÌâÄ¿²»ÄÑ,È«²¿¶¼ÄÜ¿ìËٵشðÍ꣬µ±È»Ò²ÐèÒªÒ»¶¨µ ......
constÓë#define×î´óµÄ²î±ð£¬ConstÔÚ¶ÑÕ»·ÖÅäÁ˿ռ䣬¶ø#defineÖ»ÊǰѾßÌåÊýÖµÖ±½Ó´«µÝµ½Ä¿±ê±äÁ¿°ÕÁË¡£»òÕß˵£¬constµÄ³£Á¿ÊÇÒ»¸öRun-TimeµÄ¸ÅÄËûÔÚ³ÌÐòÖÐȷȷʵʵµÄ´æÔÚ¿ÉÒÔ±»µ÷Óᢴ«µÝ¡£¶ø#define³£Á¿ÔòÊÇÒ»¸öCompile-Time¸ÅÄËüµÄÉúÃüÖÜÆÚÖ¹ÓÚ±àÒëÆÚ£ºÔÚʵ¼Ê³ÌÐòÖÐËûÖ»ÊÇÒ»¸ö³£Êý¡¢Ò»¸öÃüÁîÖе ......
1,·ÀÖ¹Ò»¸öÍ·Îļþ±»Öظ´°üº¬
#ifndef COMDEF_H
#define COMDEF_H
//Í·ÎļþÄÚÈÝ
#endif
2,ÖØж¨ÒåһЩÀàÐÍ,·ÀÖ¹ÓÉÓÚ¸÷ÖÖƽ̨ºÍ±àÒëÆ÷µÄ²»Í¬,¶ø²úÉúµÄÀàÐÍ×Ö½ÚÊý²îÒì,·½±ãÒÆÖ²¡£
typedef unsigned char boolean; /* Boolean value type. */
typedef ......