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

C测试小程序

C测试小程序
1、                 字符串类
1.1        strstr
功能:查找和获取子串
void test_strstr()
{
        char *str="Borland   International";
        char *str1="B",*ptr1;
        char *str2="na",*ptr2;
        char *str3="",*ptr3;
            
        ptr1=strstr(str,str1);    
        printf("The   substring1   is:   %s\n",   ptr1);//Borland   International
          
         ptr2=strstr(str,str2);    
        printf("The   substring2   is:   %s\n",   ptr2);//national
 
         ptr3=strstr(str,str3);    
        printf("The   substring3   is:   %s\n",   ptr3); //Borland   International
}   
/*****************************************************
  char *strstr( const char *string, const char *strCharSet );
  Each of these functions returns a pointer to the first occurrence of strCharSet in string,
  or NULL if strCharSet does not appear in string. If strCharSet points to a string of zero length,
  the function returns string.
  ******************************************************/
1.2   atoi和_itoa
功能:char和int之间的互相转换
void char2int_1()
{
char* temp1="123";
int a1=atoi(temp1);
printf("char2int_1()\ta1+1=%


相关文档:

extern "C"

C和C++互相调用函数时,使用extern "C"。
原因:
C不支持函数重载,而C++支持函数重载。函数被C++编译后会名字与C语言不同。假设某函数原型为foo(ing x, int y),被C++编译后名字为_foo_int_int,而C编译器编译后名字为_foo。 ......

c操作翻转字符串


#include<stdio.h>
#include<malloc.h>
#include<string.h>
/*
* 翻转
*/
char *mystrrev(char *arr)
{
if (!arr)
{
return NULL;
}
char *temp = arr;
char t;
int leng = strlen(arr) + 1;
int l = (int)(leng / 2);
int i = 0;
while (l--)
{
t = arr[i];
arr[ ......

C中读取数组

#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 100
main()
{
FILE *fp;
if ( (fp = fopen( "c:\\a.txt", "r" )) == NULL ) printf("ERROR!\n");
int tmp[MAXSIZE];
int i;
for ( i=0; i<MAXSIZE; i++ )
{
tmp[i] = 0; ......

Turbo C 2.0 函数中文说明大全

Turbo C 2.0 函数中文说明大全
分类函数,所在函数库为ctype.h
int isalpha(int ch) 若ch是字母('A'-'Z','a'-'z')返回非0值,否则返回0
int isalnum(int ch) 若ch是字母('A'-'Z','a'-'z')或数字('0'-'9'),返回非0值,否则返回0
int isascii(int ch) 若ch是字符(ASCII码中的0-127)返回非0值,否则返回0
int iscntrl(int ......

C/C++中typedef的用法,告诉你不一样的typedef


<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号