![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
C语言开发
C语言学习
祝你幸福365
好好学习,天天向上
展开
-
017-C语言学习常用网址和简单项目
码农网https://www.codercto.com/courses/a/17.html原创 2021-04-28 20:09:29 · 154 阅读 · 0 评论 -
016-C语言中的位运算符和移位运算符
#include<iostream>#include<stdlib.h>using namespace std;int main(int argc, char const *argv[]){ // 位运算 // 按位与运算符 & 只有都为真的情况下才会是1 其余是0 // 按位或运算符 | // a= 5(00000101) b=9(00001001) unsigned char a = 5, b = 9; //结果是 0.原创 2021-04-17 23:09:32 · 319 阅读 · 0 评论 -
015-编译器内置宏-判断操作系统
#include <stdlib.h>#include <stdio.h>#include <string.h>#include "word.txt"#define THE_NUM 3#define WIN 1#define LINUX 2#define MAC 3void sayHello(){#if PLATFORM == WIN printf("Hello Windows\n");#elif PLATFORM == Linux.原创 2021-03-12 08:23:09 · 174 阅读 · 0 评论 -
016-预处理命令#if #elif #else #ifdef
#include <stdlib.h>#include <stdio.h>#include <string.h>#define AA 1#define BB 2// #if #ifdef #ifndefvoid show_os(){ printf("show_os begin...\n"); #if _WIN32 printf("It's win32 os\n"); #elif __linux__ p.原创 2021-03-12 08:22:18 · 102 阅读 · 0 评论 -
014-宏函数
#include<stdlib.h>#include<stdio.h>#include<string.h>#include "word.txt"// 1. 定义常数#define MAX 100// 2. 定义一个宏函数void cn_com_jni_read(){ printf("read\n");}void cn_com_jni_write(){ printf("write\n");}#define jni(NAME) .原创 2021-03-12 08:21:54 · 93 阅读 · 0 评论 -
013-头文件引用冲突
#ifndef AH#define AH#include "B.h"void printfA();#endif // !AH#include<stdlib.h>#include<stdio.h>#include "A.h"void printfA(){ printf("A.....\n");}#ifndef BH#define BH#include "A.h"void printfB();#endif // !BH#includ.原创 2021-03-12 08:20:50 · 310 阅读 · 0 评论 -
000-MacOS上VSCode配置C/C++开发环境
1. 安装 C/C++ 和 Code Runer 插件2. 打开Demo文件夹,并创建Demo.c文件,Command+Shift+P 打开如下命令面板,选中 C/C++: Edit Configurations (JSON )选项,就可以创建c_cpp_properties.json 文件3. 按照如下修改c_cpp_properties.json中的内容{ "configurations": [ { "name": "Mac"...原创 2021-03-12 08:20:19 · 380 阅读 · 0 评论 -
012-文件的加密和解密
#include<stdlib.h>#include<stdio.h>#include<string.h>// 加密函数// 异或: 1^1 = 0 0^0 = 0 1^0 =1void encrypt(char normal_path[], char crypt_path[], char password[]){ // 打开文件 FILE *normal_fp = fopen(normal_path, "rb"); FILE *c.原创 2021-03-12 08:19:51 · 198 阅读 · 0 评论 -
011-C语言文件的读写
#include<stdlib.h>#include<stdio.h>#include<string.h>int main() { // 文件 //1. 向文件中的写入文本 char path[] = "word.txt"; // 打开 并准备写入一个文件 FILE *wf_p = fopen(path, "w"); char *text = "Hello, World!\nI Love You foreve.原创 2021-03-11 18:35:57 · 176 阅读 · 1 评论 -
010-共用体和枚举
#include<stdlib.h>#include<stdio.h>#include<string.h>// 共用体union MyValue{ int x; int y; double z;};// 枚举enum Day{ Mon, Tue, Wed, Thu, Fri, Sat, Sun};int main() { // 联合体(共用体) // .原创 2021-03-11 18:35:38 · 60 阅读 · 0 评论 -
009-结构体别名typedef
#include<stdlib.h>#include<stdio.h>#include<string.h>// 普通类型变量和指针取别名typedef int Age; // Age int类型的别名typedef int* AP; // AP int类型指针的别名// 结构体取别名typedef struct Fruit JavaFruit;typedef struct Fruit* PJavaFruit;struct Fruit { .原创 2021-03-11 18:35:21 · 861 阅读 · 0 评论 -
008-结构体字节大小和对齐
#include<stdlib.h>#include<stdio.h>#include<string.h>// 结构体指针struct Book{ char *name; char *author; int page;};struct Computer { char *name; int price; double weight;};int main() { // 结构体的大小 和字节对齐的概.原创 2021-03-11 18:34:37 · 86 阅读 · 0 评论 -
007-结构体数组遍历
#include<stdlib.h>#include<stdio.h>#include<string.h>// 结构体指针struct Book{ char *name; char *author; int page;};struct Computer { char *name; int price; double weight;};int main() { // 结构体数组 stru.原创 2021-03-11 18:34:14 · 2237 阅读 · 0 评论 -
006-结构体指针
#include<stdlib.h>#include<stdio.h>#include<string.h>// 结构体指针struct Book{ char *name; char *author; int page;};struct Computer { char *name; int price; double weight;};int main() { // 结构体指针 stru.原创 2021-03-11 18:31:19 · 48 阅读 · 0 评论 -
005-结构体嵌套
#include<stdlib.h>#include<stdio.h>#include<string.h>// 结构体嵌套// 第一种 结构体嵌套写法struct Worker { char *name; int age; struct Tearcher { char* name; int age; } teacher;};// 第二种结构体嵌套写法// 注意写法 结构体Car的声明.原创 2021-03-11 18:30:57 · 215 阅读 · 0 评论 -
004-C语言结构体struct
#include <stdlib.h>#include <stdio.h>#include <string.h>// 第一种结构体类型// 定义结构体struct Man { // 成员 char name[20]; char* hair; int age; // 函数指针a int (*func_a)(); // 函数指针b void*(*func_b)();};int doFuncti.原创 2021-03-11 18:30:38 · 123 阅读 · 1 评论 -
003-C语言字符数组和字符指针
#include <stdio.h>#include <stdlib.h>#include <string.h>int main() {// printf("Hello World!");// // 40M// int *p1 = malloc(1024 * 1024 * sizeof(int));// p1 = malloc(1024 * 1024 * 20 * sizeof(int));// if (p1 != NUL.原创 2021-03-11 18:30:13 · 104 阅读 · 0 评论 -
002-动态内存分配
#include <stdio.h>#include <stdlib.h>// puts("hello world!");// char * str = "100";// int a;// sscanf(str, "%d", &a);// printf("int value is %d\n", a);//把字符串转化成double// double value = atof("3.14");// printf("%f\n", value).原创 2021-03-11 18:29:10 · 55 阅读 · 0 评论 -
001-C指针和函数指针
#include <stdio.h>int main(int argc, const char * argv[]) { double a = 11111.22f; printf("a=%.1f\n", a); int i = 89; int *p = &i; double j = 78.9; //p = &j; printf("double size %d\n", sizeof(double)); print.原创 2021-03-09 00:15:21 · 167 阅读 · 0 评论