ѸÀ×±ÊÊÔ ×Ö·û´®·´×ª 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;
}
Ïà¹ØÎĵµ£º
¹ØÓÚº¯ÊýÖ¸ÕëÊý×éµÄ¶¨Òå
¹ØÓÚº¯ÊýÖ¸ÕëÊý×éµÄ¶¨Òå·½·¨£¬ÓÐÁ½ÖÖ£ºÒ»ÖÖÊDZê×¼µÄ·½·¨£»Ò»ÖÖÊÇÃÉÆ·¨¡£
µÚÒ»ÖÖ£¬±ê×¼·½·¨£º
{
·ÖÎö£ºº¯ÊýÖ¸ÕëÊý×éÊÇÒ»¸öÆäÔªËØÊǺ¯ÊýÖ¸ÕëµÄÊý×é¡£ÄÇôҲ¾ÍÊÇ˵£¬´ËÊý¾Ý½á¹¹ÊÇÊÇÒ»¸öÊý×飬ÇÒÆäÔªËØÊÇÒ»¸öÖ¸Ïòº¯ÊýÈë¿ÚµØÖ·µÄÖ¸Õë¡£
¸ù¾Ý·ÖÎö£ºÊ×ÏÈ˵Ã÷ÊÇÒ»¸öÊý×飺Êý×éÃû[]
Æä´Î£¬ÒªËµÃ ......
In C programming language, the observer design pattern is implemented with function pointer (aka callback function). But in Qt library, it introduces signal and slot. How to link a callback function from the C callback function to the C++ siganl and slot is a problem I encounter. Call back function ......
1.strlen()
ʵÏÖ£º
size_t strlen(const char *s)
{
size_t n;
for(n = 0; *s != '\0'; s++)
++n;
return n;
  ......
1,·ÀÖ¹Ò»¸öÍ·Îļþ±»Öظ´°üº¬
#ifndef COMDEF_H
#define COMDEF_H
//Í·ÎļþÄÚÈÝ
#endif
2,ÖØÐ¶¨ÒåһЩÀàÐÍ,·ÀÖ¹ÓÉÓÚ¸÷ÖÖÆ½Ì¨ºÍ±àÒëÆ÷µÄ²»Í¬,¶ø²úÉúµÄÀàÐÍ×Ö½ÚÊý²îÒì,·½±ãÒÆÖ²¡£
typedef unsigned char boolean; /* Boolean value type. */
typedef ......