mysql c测试程序_C测试小程序

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=%

相关文档:

利用c.vim插件,你可以实现

添加文件头

添加注释

插入一些代码片段

语法检查

读函数文档

注释代码块

这一插件的作者是 Fritz Mehner, 目标就是打造程序员流畅的编辑环境。

这一插件还能完成:

Statement oriented editing of C / C++ programs

Speed up writing new code considerably.

Write code and ......

#include

#include

#include

/*

* 翻转

*/

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学的不怎么样啊,好多函数都不记得,在网上搜到的都是些乱七八糟的,没有原型,用起来不放心,用E文搜,搜到真正的Bible——

The GNU C Library Manual

这里面太全了,只是有一点不太好,E文的,读起来有点慢,感觉有点浪费时间

用C写了段小程序把一个五笔码文本文档转 ......

C语言中有几个基本输入函数:

//获取字符系列

int fgetc(FILE *stream);

int getc(FILE *stream);

int getchar(void);

//获取行系列

char *fgets(char * restrict s, int n, FILE * restrict stream);

char *gets(char *s);//可能导致溢出,用fgets代替之。

//格式化输入系列

int fscanf(FILE * r ......

#include

#include

#include

#include

#include

#include

#include

typedef struct worker

{

int num; //编号

char name[15]; //姓名

char zhicheng[15];& ......

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值