VecFirst
VecFirst
Description
Value of first element in vector.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in | Vector to get first element of. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
VecCharPtr.c:123:
case VEC_CHAR_PTR_FIRST : {
if (VecLen(vec) > 0) {
char *first = VecFirst(vec);
(void)first; // Use the result to avoid warnings
}- In
VecStr.c:123:
case VEC_STR_FIRST : {
if (VecLen(vec) > 0) {
Str first = VecFirst(vec);
(void)first; // Use the result to avoid warnings
}- In
VecInt.c:101:
case VEC_INT_FIRST : {
if (VecLen(vec) > 0) {
volatile i32 first = VecFirst(vec);
(void)first;
}- In
MisraEnum.c:111:
// last value starts with invalid enum's value
if (invalid_enum.name.length) {
last_value = invalid_enum.name.length ? invalid_enum.value : VecFirst(&entries).value;
StrWriteFmt(&code, " {} = {},\n", invalid_enum.name.data, invalid_enum.value);
}- 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:100:
// Check first and last elements
bool result = (VecFirst(&vec) == 10);
result = result && (VecLast(&vec) == 30);- In
Vec.Access.c:104:
// Modify first and last elements
VecFirst(&vec) = 15;
VecLast(&vec) = 35;- In
Access.h:19:
/// Access first character in string
///
#define StrFirst(str) VecFirst(str)
///
Last updated on