码迷,mamicode.com
首页 >  
搜索关键字:malloc    ( 2467个结果
关于动态栈的分析
栈属于数据结构,它本质上属于线性表,只是受限的线性表。我们今天来讨论下动态栈也就是链栈的相关问题。#include<stdio.h> #include<stdlib.h> #include<malloc.h> typedefstructNode { intdata; structNode*pNext; }NODE,*PNODE; typedefstructStack {..
分类:其他好文   时间:2014-07-29 15:28:39    阅读次数:248
Cstyle的札记,Freertos内核详解,第1篇
一种动态内存管理Malloc/Free服务的链表实现 , 动态内存分配与回收服务,Malloc/Free的实现,最主要的核心内容是单向链表。其数据结构定义如下,一整段内存被SRAM或SDRAM,DRAM由系统的内存管理模块统一管理,这里主要是堆的管理: typedef struct A_BLOCK_LINK {      struct A_BLOCK_LINK  *pxNextFre...
分类:其他好文   时间:2014-07-29 13:21:31    阅读次数:433
”Java 方法可以返回数组类型“ 所想到的
在C和C++中不能返回一个局部变量,因为函数中的局部变量分配的存储空间在栈上,当函数执行完后会被重新利用,所以想要返回数组类型,有两种方式:1)静态变量(static in a function可以在函数调用之间保持值有效),2)利用malloc动态分配,但是最终要记得释放。下面是几个简单测试程序: 1.错误的示例: #include int *func(int n){...
分类:编程语言   时间:2014-07-28 15:49:23    阅读次数:263
CSAPP 书附带的代码中找不到的 config.h 在此给出(坑爹啊。。。)
原本是在实现malloc的过程中要有个#include "config.h" 但是怎么找都找不到,只要google,还好有好心人给出了config.h 不然我怎么都不明白HEAP_MAX究竟是多少。。。。 #ifndef __CONFIG_H_ #define __CONFIG_H_ /* * config.h - malloc lab configuration file *...
分类:移动开发   时间:2014-07-28 15:43:03    阅读次数:620
malloc中 heap block 的 blocksize 大小问题
heap block 引发的思考 问题背景: Implicit Free Lists                   Any practical allocator needs some data structure that allows it to distinguish block boundaries and to distinguish between allo...
分类:其他好文   时间:2014-07-27 23:38:29    阅读次数:452
hdu1298 T9(手机输入法,每按一个数字,找出出现频率最高的字串,字典树+DFS)
Problem Description A while ago it was quite cumbersome to create a message for the Short Message Service (SMS) on a mobile phone. This was because you only have nine keys and the alphabet has more t...
分类:移动开发   时间:2014-07-26 02:40:36    阅读次数:332
娓娓道来c指针 (2)内存分配
c语言中描述变量的时候常用的两个用语 1.作用域:也叫可见域,指的是变量的作用范围。在哪个范围内,该变量是可以使用的,可见的。 2.生存期:也叫存储期,指的是变量从创建到销毁的生存时间段。 作用域和存在域是两个不同的概念,比如在程序的某个位置,某变量存在(内存中分配了地址)但不可见(不可使用)。...
分类:其他好文   时间:2014-07-25 11:21:51    阅读次数:165
hdu2222Keywords Search (字典树)
Problem Description In the modern time, Search engine came into the life of everybody like Google, Baidu, etc. Wiskey also wants to bring this feature to his image retrieval system. Every image hav...
分类:其他好文   时间:2014-07-24 23:22:23    阅读次数:256
hdu1800Flying to the Mars (字典树)
Problem Description In the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . Finally , PPF decides to attack Kscinow w...
分类:其他好文   时间:2014-07-24 12:25:06    阅读次数:219
realloc函数引发的惨案
帮别人调试个程序,程序的功能主要涉及动态数组,实现动态数组元素的添加,删除,查找,显示功能。但是在执行添加功能的时候,连续执行三次添加的时候就会出现问题,让人感到非常的莫名其妙。 涉及到的函数如下所示: void adddata(int * arr, int * len) { int n; int *add; int cnt=0, t1;...
分类:其他好文   时间:2014-07-24 10:38:22    阅读次数:342
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!