---
name: "elf_nextscn"
section: "3"
platform: "linux"
package: "libelf"
version: "0.197-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/elf_nextscn"
---

# elf\_nextscn(3)

Return the next section in an ELF descriptor.

## NAME

elf\_nextscn - Return the next section in an ELF descriptor.

## SYNOPSIS

```
#include <libelf.h>
Elf_Scn *elf_nextscn(Elf *elf, Elf_Scn *scn);
```

## DESCRIPTION

The **elf\_nextscn**() function returns a handle to the next section in the ELF object descriptor *elf*. If *scn* is NULL, the first section (with index 1) is returned. Section index 0 is reserved and skipped.

If *scn* is not NULL, the section immediately following it is returned. If there are no further sections, NULL is returned.

## PARAMETERS

- *elf*

  A pointer to an ELF descriptor.

- *scn*

  A section handle returned by [**elf\_getscn**(3)](/elf_getscn/3.md), or NULL to begin iteration.

## RETURN VALUE

Returns a pointer to the next **Elf\_Scn** structure in the section list, or NULL if there are no more sections or if *elf* is NULL.

## SEE ALSO

[**elf\_getscn**(3)](/elf_getscn/3.md), [**elf\_newscn**(3)](/elf_newscn/3.md), [**libelf**(3)](/libelf/3.md), [**elf**(5)](/elf/5.md)

## ATTRIBUTES

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **elf\_nextscn**() | Thread safety | MT-Safe |

## REPORTING BUGS

Report bugs to \<elfutils-devel@sourceware.org\> or https://sourceware.org/bugzilla/.
