⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utility.h

📁 一个很好的粒子滤波算法
💻 H
字号:
#ifndef _UTILITY_H#define _UTILITY_H/* utility.h * coded by Alex Gruenstein for CS107, TA: AndyG * This is the interface to a useful memory allocation * function (GetBlock) and a useful macro (New) *//* macro: New(type) * This is a macro written by Eric Roberts for cs106 that * simplifies memory allocation.  It is used to * allocate memory for a given type (eg a struct). * usage: struct myStruct *m = New(struct myStruct) */#define New(type) ((type) GetBlock(sizeof *((type) NULL)))/* function: GetBlock * this is a modified version of the function developed * by Eric Roberts for cs106.  It is an error checking * wrapper for malloc().  It ensures that the memory * could be allocated, and if not it halts the program * via the assert macro.   * it returns a pointer to free blcok of memory in the heap  * of a given size (in bytes) */void *GetBlock(unsigned int size);/* function: CopyString * this is a utility function supplied by cs107 that I have * modified slightly. * it places a copy of a string in memory that it allocates * on the heap * returns: a pointer to the new string */char *CopyString(const char *s);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -