- 博客(6)
- 收藏
- 关注
转载 有关realloc malloc calloc
realloc,malloc,calloc的区别三个函数的申明分别是: void realloc(void ptr, unsigned newsize); void malloc(unsigned size); void calloc(size_t numElements, size_t sizeOfElement); 都在stdlib.h函数库内它们的返回值都是请求系统分配的地址,如果请求失败就...
2019-09-13 10:46:37
142
转载 C语言编程 产生一个随机数
利用rand()函数来返回一个一随机数值,范围在0至RAND_MAX间。返回0至RAND_MAX之间的随机数值,RAND_MAX定义在stdlib.h,(其值至少为32767)。具体要看定义的变量类型,int整型的话就是32767。此时产生的是一个伪随机数值,在调用此函数产生随机数前,必须先利用srand()设好随机数种子,如果未设随机数种子,rand()在调用时会自动设随机数种子为1。利...
2019-08-02 19:32:55
1617
转载 C语言数据结构 链表总结
单向链表(无头无循环)1.头插cur->next=head;head=cur;2.后插cur->next=pos->next;pos->next=cur;3.头删tmp=head->next;free(head);head=tmp;4.后删tmp=pos->next;pos->next=tmp->next;free(tmp)...
2019-07-22 16:47:50
160
转载 C语言数据结构 双向链表以及基本功能实现
项目头文件:#ifndef _LIST_H_#define _LIST_H_#include <stdio.h>#include<stdlib.h>typedef int LTDataType;typedef struct ListNode { LTDataType _data; struct ListNode* _next; stru...
2019-07-22 11:31:12
159
转载 C语言数据结构 单链表及其基本功能实现
头文件如下:#ifndef _SLIST_H_#define _SLIST_H_typedef int SLTDataType;typedef struct SListNode{ SLTDataType data; struct SListNode* next;}SListNode;void SListInit(SListNode** phead);void S...
2019-07-22 09:56:55
149
转载 C语言数据结构 线性表的基本功能实现
头文件如下#ifndef _SEQLIST_H_#define _SEQLIST_H_// 顺序表的动态存储#include <stdio.h>#include <stdlib.h>#include <string.h>typedef int SLDataType;typedef struct SeqList { SLDataTyp...
2019-07-22 09:53:23
149
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅