VecLast
- Macro
- October 8, 2025
Table of Contents
VecLast
VecLast
Description
Value of last element in vector.
Parameters
Name | Direction | Description |
---|---|---|
v | in | Vector to get last element of. |
Usage example (Cross-references)
- In
Vec.Access.c:88
:
// Test VecFirst and VecLast functions
bool test_vec_first_last(void) {
WriteFmt("Testing VecFirst and VecLast\n");
// Create a vector of integers
- In
Vec.Access.c:101
:
// Check first and last elements
bool result = (VecFirst(&vec) == 10);
result = result && (VecLast(&vec) == 30);
// Modify first and last elements
- In
Vec.Access.c:105
:
// Modify first and last elements
VecFirst(&vec) = 15;
VecLast(&vec) = 35;
// Verify changes
- In
Access.h:24
:
/// Access last character in string
///
#define StrLast(str) VecLast(str)
///
- In
VecInt.c:109
:
case VEC_INT_LAST : {
if (VecLen(vec) > 0) {
volatile i32 last = VecLast(vec);
(void)last;
}
- In
VecStr.c:131
:
case VEC_STR_LAST : {
if (VecLen(vec) > 0) {
Str last = VecLast(vec);
(void)last; // Use the result to avoid warnings
}
- In
VecCharPtr.c:131
:
case VEC_CHAR_PTR_LAST : {
if (VecLen(vec) > 0) {
char *last = VecLast(vec);
(void)last; // Use the result to avoid warnings
}