C
文章平均质量分 82
码上起飞
这个作者很懒,什么都没留下…
展开
-
Leetcode LCP 44. 开幕式焰火
文章目录题目链接代码法一利用uthash法二哈希表题目链接LCP 44. 开幕式焰火代码法一利用uthash/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */struct my_struct { int id;原创 2022-04-05 20:58:14 · 390 阅读 · 0 评论 -
位运算技巧
逻辑位运算符位与(&)位或(|)异或(^)异或也叫半加运算,其运算法则相当于不带进位的二进制加法:二进制下用1表示真,0表示假,则异或的运算法则为:0⊕0=0,1⊕0=1,0⊕1=1,1⊕1=0(同为0,异为1),这些法则与加法是相同的,只是不带进位,所以异或常被认作不进位加法。若需要交换两个变量的值,除了通常使用的借用中间变量进行交换外,还可以利用异或,仅使用两个变量进行交换,如:void swap(int &a,int &b){ a=a^.原创 2022-03-16 23:47:10 · 187 阅读 · 0 评论 -
C语言疑难杂症
文章目录结构体结构体C 不支持结构体比较。必须通过一一比较所有成员来比较结构体structs are not valid operands for equality(==), the operands have to be an arithmetic type or a pointer. We can see this from the draft C99 standard section 6.5.9 Equality operators:One of the following shall hol原创 2022-03-12 03:34:30 · 794 阅读 · 0 评论 -
C语言第八章The Preprocessor
文章目录Preprocessor Directives(指令)The #include DirectiveThe #define DirectiveFormatting Preprocessor DirectivesPredefined Macro DefinitionsConditional Compilation DirectivesThe #ifdef, #ifndef, and #undef DirectivesConditional Compilation DirectivesPreprocess原创 2022-03-11 08:26:25 · 290 阅读 · 0 评论 -
【C语言第七章Files & Error Handling】
文章目录Working With FilesAccessing FilesWorking With FilesAccessing FilesAn external file can be opened, read from, and written to in a C program. For these operations, C includes the FILE type for defining a file stream. The file stream keeps track of whe原创 2022-03-09 14:03:30 · 1043 阅读 · 0 评论 -
C语言小知识
目录C中未初始化的变量,默认值是多少?C语言中定义int变量,默认值是多少?C语言中有bool变量吗?5 == 5.0?取值运算符* 优先级高于+逗号运算符的优先级最低,从左到右计算,例如(5,3,0)结果为0,(0,3,5)结果为5printf函数的返回值是输出的长度C中未初始化的变量,默认值是多少?int, char, float, double,C语言中定义int变量,默认值是多少?区分变量的类型,有两种情况:1 局部变量。局部变量.原创 2022-03-09 01:50:01 · 1463 阅读 · 0 评论 -
【VSCODE 配置C\C++环境】
文章目录配置环境变量https://winlibs.com/输入cmd回车配置环境变量按F5选择C++ (GDB/LLDB)查看launch.json文件“name”“type”“program”“externalConsole”“MIMode”“miDebuggerPath”“preLaunchTask”(匹配tasks.json里的"label")查看tasks.json文件...原创 2022-03-07 06:50:28 · 311 阅读 · 0 评论 -
C语言第六章Memory Management
文章目录Working With MemoryMemory ManagementMemory Management FunctionsThe malloc FunctionThe free Functioncalloc and reallocThe calloc FunctionWorking With MemoryMemory ManagementUnderstanding memory is an important aspect of C programming. When you declar原创 2022-03-03 12:10:22 · 255 阅读 · 0 评论 -
C语言第五章Structures & Unions
文章目录StructuresDeclarations Using StructuresAccessing Structure MembersUsing typedefWorking With StructuresStructures with StructuresPointers to StructuresStructures as Function ParametersArray of Structures(未完)UnionsAccessing Union MembersStructures With U原创 2022-03-02 10:43:09 · 702 阅读 · 0 评论 -
C语言第三章Functions, Arrays & Pointers
C语言第三章Functions, Arrays & PointersFunctionsFunctions in CFunction ParametersVariable Scope(作用域)Static Variables(静态变量)Recursive(递归的) FunctionsArraysArrays in CFunctionsFunctions in CDeclarations usually appear above the main() function and take the f原创 2022-02-28 01:50:59 · 618 阅读 · 0 评论 -
C语言第二章Conditionals and Loops
文章目录ConditionalsRelational Operators(关系运算符)Conditional Expressions(条件表达式)Nested if Statements(嵌套 if 语句)The if-else if StatementThe switch StatementLogical Operators(逻辑运算符)The && OperatorThe ! OperatorThe while LoopThe do-while Loopbreak and continu原创 2022-02-21 12:34:08 · 514 阅读 · 0 评论 -
【C语言第一章基本概念】
目录基本概念输入输出输入输出Formatted InputFormatting Output基本概念输入输出输入C supports a number of ways for taking user input.getchar() Returns the value of the next single character input.#include <stdio.h>int main() { char a = getchar(); printf("You e原创 2022-02-20 05:16:49 · 492 阅读 · 2 评论 -
C语言里文字颜色色和背景颜色设置
代码演示#include <stdio.h>#include <stdlib.h> //为了用system函数,#include <windows.h> //为了用Sleep函数,也可以用system函数,例如system("cls")清屏或者system("color f5")等;int main() { system("color ...原创 2018-06-16 09:08:29 · 17951 阅读 · 1 评论 -
明解c 英文单词
source program 源程序source file 源文件diagnostic message 诊断消息comment 注释stdio standard I/O 标准输入输出printf f源自format(格式化)function call 函数调用argument 实参%d d源自decimal(十进制数)statement ...原创 2018-07-13 03:15:36 · 200 阅读 · 0 评论 -
C语言里puts函数
puts函数(末尾的s取自string)puts函数可以按顺序输出作为实参的字符串,并在结尾换行。printf 可进行格式设定和数值的输出等,需要显式指定输出换行符puts 不可进行格式设定和数值的输出等,自动输出换行符。puts函数的实参只能有一个。转自 明解c第一章...转载 2018-07-14 08:27:49 · 2585 阅读 · 0 评论 -
C语言调试的四种方式
一. 编译器警告:1. 默认, 编译器不生成所有警告。2.使用 gcc -Wall二. printf语句1.Print to stderr instead of stdout •fprintf(stderr, ….)三. assert"assert" macro provided by standard library •Prints e...原创 2018-09-14 13:38:14 · 3322 阅读 · 0 评论