---
title: getLastObject
framework: Kernel
role: symbol
role_heading: Instance Method
platforms: [driverkit 19.0+, macOS 10.15+]
path: kernel/osarray/3180814-getlastobject
---

# getLastObject

Returns the last member of the array.

## Declaration

```occ
OSObject * getLastObject(void);
```

```occ
virtual OSObject * getLastObject(void);
```

## Return Value

Return Value Member at the last index or NULL if array has no members.

## Discussion

Discussion If the array has non-zero count the member at the last index is returned, with no additional retain count (the caller should not release). Otherwise NULL.

## See Also

### Accessing Elements

- [getObject](kernel/osarray/3180816-getobject.md)
- [getNextIndexOfObject](kernel/osarray/3180815-getnextindexofobject.md)
- [setObject](kernel/osarray/3180822-setobject.md)
- [setObject](kernel/osarray/3433840-setobject.md)
- [iterateObjects](driverkit/osarray/iterateobjects.md)
- [replaceObject](kernel/osarray/3180821-replaceobject.md)
- [removeObject](kernel/osarray/3180820-removeobject.md)
