
c
zl1016xixi
i'm fine thanks
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
多个指针指向一块内存问题
理解c++中的深拷贝和浅拷贝原创 2020-04-06 12:22:44 · 786 阅读 · 0 评论 -
汉诺塔的实现
#include<stdio.h> //参数的意义:n个盘子全部在x上,最终要把这n个盘子移到z上,借助y void hannuota(int n,char x,char y,char z){ if(n==1){ printf("将第%d个盘子从%c直接移到%c柱子上\n",n,x,z); }else{ //把前n-1个盘子从x上移动到z上,借助y hannuota(n...原创 2019-11-14 18:52:36 · 230 阅读 · 1 评论 -
数组实现循环队列(c语言)
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> #define LEN 6 typedef struct Queue{ int * pBase; int front; int rear; }QUEUE; void init(QUEUE *); bool en_queue(QUEUE ...原创 2019-11-13 10:00:29 · 814 阅读 · 0 评论 -
c语言实现哈希表数据结构
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> #define NULLKEY -32768 typedef struct HashTable{ int * pElem; int count; }HT,*PHT; void init(PHT pHashTable); bool inser...原创 2019-11-08 21:06:56 · 1598 阅读 · 0 评论 -
使用链表实现数据结构中的栈
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> typedef struct Node{ int data; struct Node * pNext; }NODE,*PNODE; typedef struct Stack{ PNODE pTop; PNODE pBottom; }STAC...原创 2019-11-07 18:17:47 · 315 阅读 · 1 评论 -
链表操作(全)
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> typedef struct Node{ int data; struct Node * pNext; }NODE,*PNODE;//相当于struct Node NODE,struct Node *PNODE; //函数声明 PNODE cr...原创 2019-11-06 17:20:14 · 252 阅读 · 0 评论 -
结构体实现java的ArrayList类(增删改查、插入、倒置、排序)
#include<stdio.h> #include<stdlib.h> #include<malloc.h> #include<stdbool.h> /* 2019年11月5日10:24:20 */ struct Arr{ int *pBase; int len;//数组的长度 int cnt;//数组的有效长度 }; //判断数组是否为空...原创 2019-11-05 10:26:48 · 508 阅读 · 0 评论 -
使用malloc函数创建动态数组
#include<stdio.h> #include<stdlib.h> //使用malloc函数动态创建一个数组 int main(){ /* malloc接收一个整型参数 malloc(20)代表申请20个字节的内存空间 返回申请内存空间的首地址 */ /*申请一个4*3字节的内存,返回申请内存的首地址 但是内存有了,还要说明用什么数据类型来解析 ...原创 2019-11-04 10:27:07 · 4208 阅读 · 1 评论 -
修改指针变量的值
#include<stdio.h> void f(int *p); void ff(int ** q); int main(){ int i = 10; int *p = &i; printf("%d\n",i); f(&i);//想要修改i的值,需要传递i的地址过去 printf("%d\n",i); printf("%p\n",p); ff(&a...原创 2019-11-04 08:32:04 · 2986 阅读 · 0 评论 -
链表的创建、插入、删除(c语言)
#include<stdio.h> #include<stdlib.h> typedef int elemType; typedef struct Node{ elemType date; struct Node *next; }Node; //头插法建立单链表 Node *LinkedListCreatH(){ Node *L; L = (Node *)mal...原创 2019-11-03 16:24:31 · 287 阅读 · 0 评论 -
创建链表(c语言)
#include<stdio.h> #include<stdlib.h> typedef int elemType; typedef struct Node{ elemType date; struct Node *next; }Node,*LinkedList; //头插法建立单链表 LinkedList LinkedListCreatH(){ Node *L;...原创 2019-11-03 11:45:46 · 278 阅读 · 0 评论 -
c语言中使用数组和指针定义字符串的区别
在c语言中定义一个字符串有两种方式 1、使用指针的方式定义字符串 char *s = "hello"; 这种方式可以给指针变量s赋予不同的地址,但是s所指向地址中的内容是不会变的。 也就是说指针的指向可以改变。但是所指向的内容是不能改变的。 因此使用指针的方式是不能操作所指向地址中的内容。 char *s = "hello"; s = "world";//这种操作是正确的。只是改变了指针的指向...原创 2019-11-02 11:54:53 · 1095 阅读 · 1 评论 -
c语言中数据存放方式(大小端)
c语言中数据存放方式(大小端) 大端:低位数据存放在高地址处。 小端:低位数据存放在低地址处。 例如: int a = 0x12345678;(a在内存中占4个字节) char* b = (char*)&a; 如果b[0]对应的值为0x12,则高位数据存放在低址值(大端) 如果b[0]对应的值为0x78,则低位数据存放在低地址(小端) #include<stdio.h> int...原创 2019-11-01 10:32:37 · 1335 阅读 · 0 评论 -
将输入复制到输出,并将其中连续的多个空格用一个空格代替
#include <stdio.h> int mian(){ int c; while((c=getchar())!=EOF){ if(c == ' '){ putchar(c);//如果遇到一个输入的 空格,先将这个空格和空格前面的内容输出 while((c=getchar())!=EOF);//如果后面的还是空格,什么都不做 } putchar(c); ...原创 2019-09-03 21:53:33 · 510 阅读 · 1 评论 -
C语言(gcc)编译过程
linux环境下演示gcc编译过程 分步编译命令 作用 指令 预处理 gcc -E hello.c -o hello.i 编译 gcc -S hello.i -o hello.s 汇编 gcc -c hello.s -o hello.o 链接 gcc hello.o -o hello_elf 选项 含义 -E(大写) 只进行预处理 -S(大写) ...原创 2019-09-01 16:07:42 · 1616 阅读 · 0 评论