自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(1)
  • 资源 (3)
  • 收藏
  • 关注

原创 npuctf

NPUCTF 复现 CTF WP 计算机网络 CTF 学习总结 密码学 操作系统 NPUCTF 复现 2个月前 / 0评 / 1赞 赏 码比赛的时候运维太差了,所以就想着赛后复现一下。Table of Contents[NPUCTF2020]ReadlezPHP[NPUCTF2020]ezlogin[NPUCTF2020]验证????[NPUCTF

2020-06-26 16:16:42 681

香港理工大学CATIA 飞机教程

香港理工大学CATIA 飞机教程

2011-12-07

C语言高级编程及实例部.rar

例1:本节给出三个非常实用和高速的内存分配函数。读者可以直接拷贝这三个函数到程序中去,使用Allocate()和My_Free()代替系统提供的alloc()和free()函数。调试环境为TC2.0或者TC3.0 /* FILE: ALLOCATE.C */ #define PRIVATE static /* Used to hide identifiers from BIND */ #define BLKSIZ 80 /* Size of allocation block */ #define STKSIZ 1000 /* Bytes reserved for stack */ #define MLCSIZ 3000 /* Bytes reserved for malloc() */ typedef union { char *link ; char data[BLKSIZ] ; } BLOCK ; PRIVATE char *btm_of_heap ; PRIVATE char *top_of_heap ; PRIVATE BLOCK *heap ; void Init_Heap() { unsigned *ptr ; unsigned size ; unsigned blk ; unsigned ttl_blks ; freeall(STKSIZ) ; /* Reserve a stack of 500 words */ ptr = _memory() + 1 ; /* Get pointer to heap size */ size = *ptr ; /* Get size of heap */ size -= MLCSIZ ; /* Keep 3K for malloc() */ ttl_blks = size/sizeof(BLOCK) ; /* # available blocks */ size = sizeof(BLOCK)*ttl_blks ; /* Use an even multiple */ btm_of_heap = malloc(size) ; /* Reserve the blocks */ heap = btm_of_heap ; /* Form the free list */ for (blk = 0 ; blk < ttl_blks - 1; blk++) { heap->link = heap + 1 ; heap++ ; } heap->link = 0 ; /* Establish end marker */ heap = btm_of_heap ; /* Restore head pointer */ top_of_heap = &heap[ttl_blks] ; /* 1st malloc() block */ } void My_Free(ptr) BLOCK *ptr ; { if (ptr >= btm_of_heap) { if (ptr < top_of_heap) /* Block is from my heap */ { ptr->link = heap ; heap = ptr ; return ; } else if (free(ptr)) /* Block is from C-Ware's heap */ { return ; } } puts("\nAttempt to free unallocated block!\n\7") ; exit(1) ; } char *Allocate(bytes) unsigned bytes ; { BLOCK *ptr ; if (bytes <= BLKSIZ) /* Block will fit in my size */ { if (heap != 0) /* Any free blocks? */ { ptr = heap ; heap = heap->link ; return ptr ; } } if (ptr = malloc(bytes)) /* Won't fit or none left! */ { return ptr ; } puts("Insufficient memory: malloc()\n\7") ; exit(1) ; }

2009-04-22

2009年4月份二级C语言上机复习题库50套.rar

2009年4月份二级C语言上机复习题库50套.rar

2009-04-22

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除