Pointers Toolbox

버전 1.0.0.0 (6.52 KB) 작성자: Ben Petschel
basic functions to work with pointer variables and dynamic data types
다운로드 수: 1.2K
업데이트 날짜: 2009/8/31

라이선스 보기

This toolbox implements pointer variables and can be used to implement dynamic data structures such as linked lists.

In this implementation, virtual memory is simply a large cell array and the pointers are integers that index into it. The core program keeps track of which slots are used and which are free and leaves it up to the user to ensure that all allocated slots are being used and that all pointers are used correctly.

Some advantages of this approach are that the virtual memory is distinct from the rest of the workspace, and any object can be assigned to a given memory slot.

The toolbox is intended mainly for pedagogical purposes, and provides a safe environment to learn about linked lists, dynamic data structures, wild pointers, dangling pointers, memory leaks, seg faults, etc - without having to worry about things like low-level memory allocation and type matching.

The demo file shows how to use the basic routines MALLOC, MREAD, MWRITE, MFREE, MWIPE, and how to implement a stack as a linked list.

Let me know if you find this useful. Enjoy!

인용 양식

Ben Petschel (2024). Pointers Toolbox (https://www.mathworks.com/matlabcentral/fileexchange/25179-pointers-toolbox), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0