![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c语言进阶
来条野指针
这个作者很懒,什么都没留下…
展开
-
如何在C程序中测得函数的运行时间
介绍clock()函数clock():捕捉从程序开始运行到clock()被调用时所耗费的时间。这个时间单位是clock tick即“时钟打点”。常数CLK_TCK:机器时钟每秒所走的时钟打点数。clock_t是clock()函数返回的类型clock()函数包含在time.h头文件下模板如下:#include<stdio.h>#include<time.h>clock_t start,stop;/*clock_t是clock()函数返回的变量类型*/double原创 2021-07-23 20:36:54 · 377 阅读 · 0 评论 -
C语言字符串内信息截取
#include <string.h>char * find_str(const char* a,const char* b,const char *c) {//在c字符串中寻找字符串a开始,字符串b截至的中间字符串 char* s; if (s = const_cast<char*>(strstr(c, a) + strlen(a))) { char* y; if (y = (strstr(s, b))) {原创 2021-07-23 18:45:59 · 584 阅读 · 0 评论 -
可变数组的有关操作的实现方法
通过结构体的创建来实现可变数组#include<stdio.h>#include<stdlib.h>#define BLOCK_SIZE 20//在访问数组越界时以20为单位进行数组扩充typedef struct{ int *array; int size;}Array;Array array_create(int init_size);void array_free(Array *a);int array_size(const Array *a);原创 2021-07-16 15:31:25 · 86 阅读 · 0 评论 -
有关结构体的操作
指向结构的指针struct date{ int mouth; int day; int year;}myday;stuct date *p = &myday;(*p).month = 12;p->month = 12;用->表示指针所指的结构变量的成员///结构的初始化#include<stdio.h>struct date{ int month; int day; int year;};int main(int argc,char原创 2021-07-15 23:34:30 · 118 阅读 · 2 评论