随笔分类 - c/c++
摘要:能去除空格和计算小数的加减法 define _CRT_SECURE_NO_WARNINGS include include include using namespace std; //void eatspace(char str) //{ // int i = 0; // int j = 0; /
阅读全文
摘要:内容 memcmp、memicmp原型对比 memicmp实现 memchr实现 memcmp 函数原型:extern int memcmp(void str1, void str2, unsigned int n) 参数说明:str1和str2为指定作比较的字符串,比较两个字符串的前n个字节。 m
阅读全文
摘要:文档内容 itoa、atoizhuanh ftoa atof include include include int myatoi(char str) { char istr = str; while ( istr!='\0')//遍历每一个字符 { / if (!( istr ='0')) { r
阅读全文
摘要:文档内容: memcpy、memmove、memccpy说明、比较 memcpy(拷贝)实现 memset(设置值)实现 memmove(拷贝)实现 memccpy(拷贝,遇到设定值终止拷贝)实现 memcpy()、 memmove()和memccpy() 这三个函数的功能均是将某个内存块复制到另一
阅读全文
摘要:``` include include void show1() { int p = malloc(sizeof(int) 10); printf("%p", p); for (int i = 0; i
阅读全文
摘要:``` define _CRT_SECURE_NO_WARNINGS include include include int num;//代表多少个指针,每个指针对应一个字符串 void main1() { //char p[10] = { "1123", "1231" }; int num; sc
阅读全文
摘要:``` include include define N 10 //N 开辟 N 1 的数组 void main() { //int p = malloc(sizeof(int) N);//p[5] int pp = malloc(sizeof(int ) (2 N 1)); //pp[2 N 1]
阅读全文
摘要:``` #include #include #include "sqlite3.h" char path[100] = "C:\\Users\\yincheng01\\Desktop\\1.db"; void main() { sqlite3 *db = NULL;//数据库指针 int ret = sqlite3_open(path, &db);//...
阅读全文
摘要:目录: 字符串基础知识 字符串指针指向的内存只可读不可写 字符串指针存储的是首地址,输出中文字符需设定中文环境 字符串拷贝strcpy 计算长度函数实现strlen 检索字符串函数strstr 排序函数qsort 比较两个字符串是否相等strcmp 将一个串中的所有字符都设为指定字符strcat 查
阅读全文
摘要:``` #include #include //堆排序,查找最大值,最小值速度最快 //取最大值,取最小值怎么写 //大顶堆,小顶堆。 void show(int *p, int n) { for (int i = 0; i 0;j--)//从尾部循环到头部 ,自下而上 { int parent = j / 2; int child =...
阅读全文
摘要:``` include include void swap(int pi,int pj)//交换 { int temp = pi; pi = pj; pj = temp; } void show(int p,int n)//显示数组状态 { printf("\n此时状态 "); for (int i
阅读全文
摘要:函数指针变量,在数据区,但是存储了代码区的地址,函数在代码区 栈分配内存 函数指针数组 堆上函数指针 void main3() { int( pp)(int, int) = malloc(sizeof(int( )(int, int)) 4);//堆区 pp = add; (pp + 1) = su
阅读全文
摘要:开发数据查询 define _CRT_SECURE_NO_WARNINGS include include include include include define path "kaifang.txt" char g_pp;//全局的二级指针 int imax =20151574;//标示有多少
阅读全文
摘要:malloc和calloc区别: 两者都是动态分配内存。 主要的不同是malloc不初始化分配的内存,已分配的内存中可以是任意的值. calloc 初始化已分配的内存为0。 次要的不同是calloc返回的是一个数组,而malloc返回的是一个对象。 malloc它允许从空间内存池中分配内存, mal
阅读全文
摘要:指针 指针之间不同类型不能相加 指针的类型很重要,决定指针的长度,解析方式 指针的类型决定了指针从指针的值前进几个字节 指针不能指向数据类型不同的数据 指向和数据都不可以改变 指针优先级 p++,++先执行 ++ p, p先执行,优先级接触生效 指针与数组名 a是一个指针,步长为4,&a是一个数组指
阅读全文
摘要:stack.h queue.c main.c include"queue.h" void main1() { struct queue myq; init(&myq); for (int i = 99; i
阅读全文
摘要:实现stack stack.h stack.c main.c define _CRT_SECURE_NO_WARNINGS include"stack.h" //10 %2 0 //5 %2 1 //2 %2 0 //1 %2 1 //0 void to2(int num) { if (num==0
阅读全文
摘要:内存堆栈基础 操作系统主要作用:管理调度线程和进程 内存堆栈和数据结构堆栈 内存栈的大小由编译器决定,自动释放,自动回收 内存堆是手动创建、手动释放的 数据结构中的堆是一种二叉树的模拟,常用于取出最大值或最小值 下图描述堆中二叉树关系 数据结构栈遵循先进后出的规则 程序实例: include inc
阅读全文
摘要:``` #define _CRT_SECURE_NO_WARNINGS #include #include #include #include char strpath[256] = "kaifang.txt"; char savepath[256] = { 0 }; void showlist( char str[256]) { sprintf(savepath, "C:\\%s...
阅读全文
摘要:冒泡排序 include include void main1() { int a[10] = { 3, 5, 18, 9, 23, 5, 2, 1, 0 ,2}; // 9 18 5 2 1 , 0,2 23 for (int i = 0; i a[i+1])//对比 { int temp = a
阅读全文

浙公网安备 33010602011771号