易截截图软件、单文件、免安装、纯绿色、仅160KB

迅雷笔试 字符串反转 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;
}


相关文档:

Excel writing and reading with pure c API

Reading and Writing Excel file with pure C api in windows system. tested on windows 2000, hope it can help you:
#ifndef _WINXLS_H_
#define _WINXLS_H_
/*============================================================================*
*      Include Files
*================== ......

堆栈的C代码实现

2009-09-13     16:42:43  
 今天实现堆栈结构部分的代码,并用一简单程序测试成功。
stack.h:
#ifndef _STACK_H_
#define _STACK_H_
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#define STACK_INIT_SIZE 5
#define STACKINCREMENT 5
t ......

c宏定义的技巧总结


1,防止一个头文件被重复包含
#ifndef COMDEF_H
#define COMDEF_H
//头文件内容
#endif
2,重新定义一些类型,防止由于各种平台和编译器的不同,而产生的类型字节数差异,方便移植。
typedef unsigned char      boolean;     /* Boolean value type. */
typedef ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号