随笔分类 - C语言
摘要:计算机硬件有两种储存数据的方式:大端字节序(big endian)和小端字节序(little endian)。 举例来说,数值0x2211使用两个字节储存:高位字节是0x22,低位字节是0x11。 大端字节序:高位字节在前,低位字节在后,这是人类读写数值的方法。 小端字节序:低位字节在前,高位字节在
阅读全文
摘要:#include <ft2build.h> #include FT_FREETYPE_H #include <freetype/freetype.h> #include <freetype/ftglyph.h> int main() { FT_Library pFTLib = NULL; FT_Fa
阅读全文
摘要:#include <stdio.h> #include <malloc.h> struct Hello{ void (*sayHello)(char* name); }; void sayHello(char* name){ printf("hello, %s\n",name); } int mai
阅读全文
摘要:typedef struct Person Person; typedef void (*Method)(Person *my_self); typedef struct Person { char name[12]; int age; int sex; Method behavior1; // 行
阅读全文
摘要:/**设计模式 行为模式 观察者模式 凤姐与粉丝 *2013年7月28 cheqiang87@qq.com * */ #include <stdio.h> #include <stdlib.h> struct Fans { struct Fengjie* fengjie; void ( *updat
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> typedef struct node { char name[20]; struct node *prior, *next; } stud; stud* creat( int n ) { stud *p, *h, *s;
阅读全文
摘要:sudo apt install libxrandr-dev
阅读全文
摘要:1. 使用gcc -g 参数编译生成可调试的程序app gcc main.c -o app -g 2. 启动gdb调试程序 gdb app 如果需要给程序传递参数的话,在gdb启动后使用set args传参: set args xxx xxx xxx 启动调试: run #或缩写:r 3. gdb启
阅读全文
摘要:1 编写头文件 test.h代码: #ifndef __TEST_H_ #define __TEST_H_ void sayHello(void); #endif 2 编写库代码 test.c的代码: #include <stdio.h> #include "test.h" void sayHell
阅读全文
摘要:1 编写头文件 test.h代码: #ifndef __TEST_H_ #define __TEST_H_ void sayHello(void); #endif 2 编写代码 test.c代码: #include <stdio.h> #include "test.h" void sayHello(
阅读全文
摘要:CFLAGS = -Wall -g -o CC = gcc src=$(wildcard ./*.c) obj=$(patsubst %.c, %.o, $(src)) target=app $(target):$(obj) $(CC) $^ $(CFLAGS) $@ %.o:%.c $(CC) $
阅读全文
摘要:1 make make 是Linux自带的构建器,构建的规则在makefile文件中 2 makefile文件名 makefile 或 Makefile 3 makefile中的规则 makefile的规则有三部分:目标,依赖,命令; makefile有一条或多条规则组成; 第一个目标是makefi
阅读全文
浙公网安备 33010602011771号