C/C++
文章平均质量分 97
云季
这个作者很懒,什么都没留下…
展开
-
1.1 C语言关键字及符号
C语言关键字 标准C语言共有32个关键字。 auto const static extern volatile register signed unsigned void char short int long float double struct union enum if else switch case default ...原创 2019-01-02 14:58:07 · 216 阅读 · 0 评论 -
1.4 C/C++的预处理命令
C语言中有4类预处理命令: 文件包含命令,宏定义命令,条件编译命令,编译控制命令。文件包含命令: #include <stdio.h> /*系统路径中查找文件*/#include "hello.h" /*系统和用户当前路径中查找文件*/ 宏定义命令: #define 宏名称 /* 不带参数宏定义 */#define 宏名称 字...原创 2019-01-12 15:53:23 · 251 阅读 · 0 评论 -
C语言预处理
转载:https://www.cnblogs.com/clover-toeic/p/3851102.html二话不说先上个例子:#include <stdio.h>#define VAR_DUMP printf( \ "[\n \tfile:%s\n" \ "\tline:%d\n" \ "\tdate:%s\n" \ "\ttime:%s...转载 2019-01-11 22:40:03 · 365 阅读 · 0 评论 -
Linux文件操作编程
普通文件的操作:open, close, read, write, lseek, stat, remove(unlink), chown, chmod, umask, rename,access。access("./data", F_OK); //判断文件是否存在umask(0447); //设置文件创建权限掩码int fd=open("./data",O_WRO...原创 2019-01-03 12:40:15 · 208 阅读 · 0 评论 -
gcc的基本使用
gcc编译器工作流程:preprocess(预处理),compilation(编译),assembly(汇编),link(链接)。 gcc最基本的使用方法: gcc [选项] [要编译的文件] 例:gcc hello.c 会生成a.out文件。 gcc的选项: ...原创 2019-01-03 12:39:43 · 354 阅读 · 0 评论 -
gdb基本使用方法
gdb最基本的使用流程: 1.生成可调试的程序. 例:gcc -g hello.c -o hello 2.启动GDB. 例:gdb hello 3.设置断点等. 例:break main 或者 break hello.c:行号 4.运行程序. run ...原创 2019-01-02 15:59:50 · 218 阅读 · 0 评论 -
2.5 库文件的生成及使用
分静态库和动态库 静态库:{ 静态库文件的后缀为.a,文件名以lib开头 生成静态库的方法:ar -crv 静态库名 目标文件1,... g++ 程序的源文件 -L库文件所在的目录 -l库名 } ...原创 2019-01-02 15:40:41 · 142 阅读 · 0 评论 -
2.4 C++中的IO操作
标准I/O:ostream, istream{ cout, ostream类的一个对象,可以将数据显示在标准输出设备上. cerr, ostream类的另一个对象,它无缓冲地向标准错误输出设备输出数据. clog, 类似cerr,但是它使用缓...原创 2019-01-02 15:35:58 · 102 阅读 · 0 评论 -
1.3 C++对C的扩充
关键字的扩充 asm bool true false wchar_t namespace using class public protected private friend this inline virtual throw try catch new delete ex...原创 2019-01-02 15:29:11 · 233 阅读 · 0 评论 -
2.3 C语言中的IO操作
文件IO: size_t -> typedef unsigned int size_t FILE * fopen(const char * filename, const char *mode);失败返回NULL mode 的合法取值 ...原创 2019-01-02 15:21:45 · 315 阅读 · 0 评论 -
1.2 C/C++中立即数表示方法
整型立即数表示方法 20 // 十进制 024 // 八进制 0x14 // 十六进制 20u // 无符整型 ...原创 2019-01-02 15:17:00 · 3519 阅读 · 1 评论 -
2.2 C语言标准库
标准库 标准头文件: <assert.h> <float.h> <math.h> <stdarg.h> <stdlib.h> <ctype.h> <limits.h> <setjmp.h原创 2019-01-02 15:14:22 · 212 阅读 · 0 评论 -
2.1 C语言数组与指针
指针和数组 const int *p; int const *p; int *const p; const int *const p; 常量指针 常量指针 指针常量 常量指针常量 *p不变 *p不变 p不变 p和...原创 2019-01-02 15:10:51 · 137 阅读 · 0 评论 -
1.5 printf()函数格式化输出 颜色控制 光标控制的使用方法
printf()调用格式: printf("<格式化字符串>", <参量表>);printf可以说是学习C语言最先接触的一个库函数,大家也肯定知道它的作用就是用来打印,其实它有很多功能。目录一.打印字符串二.打印参数三.转义字符表四.格式化输出参数五.打印颜色控制六.光标控制一.打印字符串直接打印字符串,这是最基础的使用方法,就像我...原创 2019-01-13 21:32:57 · 1565 阅读 · 0 评论