C语言学习
文章平均质量分 61
ChasingMoon
这个作者很懒,什么都没留下…
展开
-
多线程查找
#include#include#include#includeint flag = 0;//意味着没有找到int * addrfind = NULL;//地址struct MyStruct{ int *pfindstart;//要查找的首地址 int length;//限定长度,从地址开始 int num;//要查找的数据 int bh;//编号 int *原创 2017-11-29 07:41:31 · 398 阅读 · 0 评论 -
静态库
----静态库.c----#includevoid message(){ MessageBoxA(0, "1111", "222222", 0);}---静态库.h----void message();-------引用lib.c---------#include//动态库dll随时调用随时注入,静态库lib只能编译调用//别人写好一个lib共别人引用void mes原创 2017-11-28 07:17:28 · 162 阅读 · 0 评论 -
内存学习
#include#includevoid main(){ void *p1 = malloc(10);//p1,p2在栈上 void *p2 = malloc(20); printf("%p,%p\n", &p1, &p2);//地址在栈上 printf("%p,%p\n", p1, p2);//堆区 getchar();}#includevoid gogogo()原创 2017-11-28 07:20:45 · 226 阅读 · 0 评论 -
指针数组学习
#include#include#include#include//制作外挂//导出函数,可以加载的时候调用_declspec(dllexport) void go()//要把属性的exe改成dll,可以注入游戏中,相当于在游戏里开辟一个线程{ int *p = (int*)0xae0720;//创建一个指针指向要改变的数据的地址 while (1) { if (*p <原创 2017-11-28 07:22:03 · 191 阅读 · 0 评论 -
整数字符串转换
#include//"12345"转12345//12345转"12345"int ToNum(char *str){ char *istr = str;//保留副本 int num = 0; while (*str!='\0')//当字符串等于\0的时候就结束了 { if (*str'9')//如果不是数字,返回-1,转换失败 { return -1; }原创 2017-11-28 07:23:14 · 267 阅读 · 0 评论 -
函数指针学习
#include#includeint jia(int a, int b)//函数名就存储代码段的首地址{ return a + b;}int jian(int a, int b){ return a - b;}int cheng(int a, int b){ return a * b;}int chu(int a, int b){ return a / b;}原创 2017-11-28 07:25:06 · 207 阅读 · 0 评论 -
二级指针
#include#includevoid mainA(){ char *p[4] = { "calc","notepad","write","tasklist&pause" }; //for (int i = 0; i < 4; i++) //{ // system(p[i]);//下标的方式访问 //} //for (int i = 0; i < 4; i++) //{原创 2017-11-28 07:27:16 · 247 阅读 · 0 评论 -
位操作与二进制学习
----------内存--------------#includevoid main1(){ printf("%d\n", 10.3);//-1717986918 printf("%f\n", 10);//0.000000 //printf不管什么数据,按照%d,%f解析数据 printf("%d\n", (int)10.3);//10 printf("%f\n", (floa原创 2017-11-28 07:15:50 · 386 阅读 · 0 评论 -
简单的文件加密
#define _CRT_SECURE_NO_WARNINGS//关闭安全检查#include#includechar jia(char ch){ return ch + 1;//可以使用位加密return ch^523;}char jie(char ch){ return ch - 1;//可以使用位解密return ch^523;}void jiami(char原创 2017-12-08 09:42:42 · 612 阅读 · 0 评论 -
C++与C的语法区别1
CPP cin//#include//C风格#include#includeusing namespace std;void main1(){ //char str[20] = { "tasklist & pause" };//C风格 char str[20]{ "tasklist&pause" };//CPP风格 system(str); cin >> str;//原创 2017-12-31 12:49:15 · 2513 阅读 · 0 评论 -
命名空间
命名空间的使用#include#includeusing namespace std;namespace string1{ char str[10]{ "calc" }; void show() { //cout << "holle" << endl; cout << str << endl; }}namespace string2{ char str[10]原创 2017-12-31 13:00:00 · 257 阅读 · 0 评论 -
C++和C的区别2
auto#includeusing namespace std;//auto自适应数据类型,自动推理void main1(){ //auto num = 10;//int //auto num = 10.1;//double //outo num = 'A';//char auto num = L"bobo"; cout << typeid(num).name() <<原创 2017-12-31 13:05:13 · 338 阅读 · 0 评论 -
lambda表达式
初级部分#includeusing namespace std;//解决函数嵌套void main1(){ [] {cout << "hello world"; }();//hello world limbda表达式 cin.get();}void main2(){ //auto fun = [] {cout << "hello world"; };//这里fun原创 2018-01-06 18:46:27 · 277 阅读 · 0 评论 -
与,或,异或 学习
#include#include-------------------&与------------------------//任意输入int类型数据,打印内存的二进制储存void mainA(){ //int类型占4个字节,四个字节32位 int num; scanf_s("%d", &num); printf("\nnum=%d,&num=%p\n", num, &num);原创 2017-11-28 07:12:09 · 253 阅读 · 0 评论 -
内存分配静态数组
#include#include//-------静态数组---------void main1(){ //int a[1024 * 1024];//栈内容有限,报错,栈溢出 //int num = 100; //int a[num];//在VC里是不行的GCC没问题,VC数组必须常量,GCC可以是变量,依然可能栈溢出}//增加 查找 删除 修改int a[10];原创 2017-11-28 07:09:34 · 619 阅读 · 0 评论 -
一级指针学习
#include#include//一级指针主要用途 ://1.函数改变外部变量//2.跨进程改变变量//3.数组作为参数,(数组会退化成一个参数),指针可以作为形参接收数组首地址void main1(){ int num = 10; num = 5;//直接修改 printf("%d\n",num); int *p = # *p = 3;//间接修改 printf原创 2017-11-28 07:05:12 · 207 阅读 · 0 评论 -
struct与指针
#include#include//一级指针的用途:简介访问结构体,创建一个堆上个变量,储存这个变量的地址struct info{ int num; float score;};void main1(){ //如何构建一个指针变量访问结构体info struct info info1;//构建一个变量info1 //赋值表达式的值等于被赋值变量的值 printf("%原创 2017-11-29 07:41:44 · 1538 阅读 · 0 评论 -
20171129二维数组指针访问
#include#include//数组在内存中是线性排列的,改变指针类型就能改变数组的访问方式void main1()//动态建立二维指针{ int *p = (int*)malloc(sizeof(int) * 40);//一维数组 for (int *px = p,i=0; px < p + 40; px++,i++) { *px = i; printf("%d,%p原创 2017-11-29 07:47:49 · 324 阅读 · 0 评论 -
检索本地本文
#define _CRT_SECURE_NO_WARNINGS#include#include#includechar **pp = NULL;//存储指针数组的地址int getfilesize(char *path)//获取文件大小{ FILE *pf; pf = fopen(path, "r");//读取的模式打开 if (pf == NULL) { retur原创 2017-12-01 07:06:19 · 249 阅读 · 0 评论 -
const
#include#include//const int *p//int const *p//int * const p//const int *const p//int const * const p//const在*左边,指向的是一个常量//const在*右边,指针是一个常量void main(){ int num = 10; num = 20; const int原创 2017-12-01 07:09:15 · 185 阅读 · 0 评论 -
字符串应用
#define _CRT_SECURE_NO_WARNINGS#include#include//sprintf的作用:生成一个指令,把他映射到字符串里,对他初始化void main1(){ //char str[100] = "for /l %i in (1,1,5) do calc"; //char *p = "for /l %i in (1,1,5) do calc"; //原创 2017-12-01 07:11:58 · 239 阅读 · 0 评论 -
结构体对齐和深拷贝浅拷贝
-------------------结构体对齐-----------------------#include#includestruct info{ //结构体变量的大小能够被其最宽基本类型成员的大小锁整除 //22 同类型不需要加在一起 short sh1; //2 最宽基本类型 char sh2; //1 char ch[19];//19+1 //28 sh原创 2017-12-01 07:16:20 · 304 阅读 · 0 评论 -
队列
队列.h 头文件#include#include#define N 100//队列长度#define datatype char//队列数据类型struct queue{ datatype data[N];//队列大小 int front;//开头 int rear;//结尾};void init(struct queue *myq);//初始化队列int is原创 2017-12-01 07:18:27 · 227 阅读 · 0 评论 -
链式栈
头文件#define datatype intstruct stacknode{ int num;//编号 datatype data;//数据 struct stacknode *pNext;//指针域,指针域存放指向下一个结点的指针,以实现链表彻底线型结构};struct stacknode *init(struct stackonde *phead);//初始化struct原创 2017-12-19 17:37:33 · 320 阅读 · 0 评论 -
按照密码加密文件
头文件#define _CRT_SECURE_NO_WARNINGS#include#include#include//字符串按照密码加密char *stringJiami(char *password, char *string);//字符串加密char *stringJiemi(char *password, char *string);//字符串解密void file原创 2017-12-11 21:13:07 · 288 阅读 · 0 评论 -
20171124动态数组接口封装完成
头文件 动态数组.h#include#includestruct data{ int *p;//指针保存数组的起始点 int length;//保存数组的长度 int stat;//0代表无序,1代表从小到大,2代表从大到小 int reallength;//实际分配的内存长度};//findalldata需要返回地址和个数,所以需要返回一个结构体struct fin翻译 2017-11-24 07:44:45 · 272 阅读 · 0 评论 -
二进制加密加密
#define _CRT_SECURE_NO_WARNINGS//关闭安全检查#include#includeint getfilesize(char *path){ FILE *pfr = fopen(path,"r"); if (pfr == NULL) { return -1; } else { fseek(pfr, 0, SEEK_END);//指针移动到末原创 2017-12-15 09:26:57 · 6559 阅读 · 1 评论 -
函数包装器function
#include#include//包装头文件using namespace std;using std::function;//函数包装器void go(){ cout << "go" << endl;}int add(int a, int b){ return a + b;}void main(){ functionfun1 = go;//返回值为void,原创 2018-01-06 18:55:29 · 469 阅读 · 0 评论