This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
notes:data:fall2023:projects:ttb0 [2023/09/14 02:58] – [MALLOC’ED ARRAY] cfoster8 | notes:data:fall2023:projects:ttb0 [2023/09/14 02:58] (current) – [MALLOC’ED ARRAY] cfoster8 | ||
---|---|---|---|
Line 76: | Line 76: | ||
| | ||
=====MALLOC’ED ARRAY===== | =====MALLOC’ED ARRAY===== | ||
- | |||
- | To access the specific parts of your array you need to use (*(ptr)). | ||
- | The ptr is the pointer and it can be added to (*(ptr+n)).. If you want to use a part of the structure you will need to put the name of it at the end of (*(ptr)).(varible). You can use an int to add to ptr. The ptr starts with zero so use one more number than you want. | ||
- | |||
The array exists as a linear allocation of memory, and any particular value in the array can be accessed by adding the value of that location to the pointer when calling it | The array exists as a linear allocation of memory, and any particular value in the array can be accessed by adding the value of that location to the pointer when calling it | ||