C/C++
公子无缘
这个作者很懒,什么都没留下…
展开
-
【C/C++】#define的用法大全
Definition:The #define DirectiveYou can use the #define directive to give a meaningful name to a constant in your program. The two forms of the syntax are:Syntax#define identifier token-stringopt#define identifier[( identifieropt, … , identifieropt )]转载 2020-05-21 10:16:48 · 1492 阅读 · 0 评论 -
【C/C++】C语言 makefile文件与头文件的写法
makefile 文件的书写。总结下make 执行过程1)make 在当前目录下找 "Makefile"或"makefile"的文件2)如果找到,则会找文件中第一个目标文件(target)。3)如果 main 命令的执行,依赖后面命令执行所产生的文件,则先执行后面命令 4)当main 命令需要的文件生成完毕,则执行main 命令makefile:#开头的都是注释一般的格式是: target:components rule第一行表示的是依赖关系,第二行是所需文件齐全后得出转载 2020-05-14 19:48:27 · 1899 阅读 · 0 评论 -
【C/C++】简单的函数指针的应用
1.简单的函数指针的应用形式1:返回类型(*函数名)(参数表)char (*pFun)(int); char glFun(int a){ return;} void main() { pFun = glFun; (*pFun)(2); }第一行定义了一个指针变量pFun。首先我们根据前面提到的“形式1”认识到它是一个指向某种函数的指针,这种函数参数是一个int型...转载 2020-05-07 10:12:52 · 156 阅读 · 0 评论 -
【C/C++】银行账户校验程序
【bank_ai.c】#include <stdio.h>#include <stdlib.h>#include <assert.h>#include <string.h>#include "bank_ai.h"char* guess_one_digit(char led_digit[MAX_LINE][MAX_ROW], char ...原创 2020-04-28 16:53:16 · 437 阅读 · 0 评论 -
【C/C++】康威生命游戏——conway game
<conway_game.c>#include <stdio.h>#include <stdlib.h>#include <assert.h>#include <string.h>#include "conway_game.h"int main(void){ if(GripInit() != 0) {...原创 2020-04-28 16:40:01 · 2241 阅读 · 0 评论 -
【C/C++】GDB调试
一.gdb常用命令:命令 描述backtrace(或bt) 查看各级函数调用及参数finish 连续运行到当前函数返回为止,然后停下来等待命令frame(或f) 帧编号 选择栈帧info(或i) locals 查看当前栈帧局部变量的值list(或l) 列出源代码,接着上次的位置往下列,每次列10行list 行号 列出从第几行开始的源代码list 函数名 列出某个函数的源代码nex...原创 2020-11-12 08:51:50 · 794 阅读 · 0 评论 -
【Linux】程序的内存分配
可以通过命令objdump -t bgw | grep bss | wc -l查看bss个数,objdump -t bgw | grep data | wc -l查看data个数其中,bss段(bss segment)通常是指用来存放程序中未初始化的全局变量的一块内存区域;data段用于存储初始化的全局变量;rodata段也叫常量区,用于存放常量数据,只读;text段是用于存放程序代...原创 2020-04-24 10:36:20 · 392 阅读 · 0 评论 -
【C/C++】不同系统中数据类型所占字节
原创 2020-04-24 10:23:09 · 159 阅读 · 0 评论 -
LeetCode题解(C/C++、JAVA)
1 两数之和(Two Sum)/** * Note: The returned array must be malloced, assume caller calls free(). */int* twoSum(int* nums, int numsSize, int target) { int *res = (int*)malloc(sizeof(int)*2); fo...原创 2019-08-27 16:51:22 · 655 阅读 · 0 评论