# session_next_session

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/session.c#L277
- **Page:** https://libtmux.org/en/tmux/latest/reference/c-function-session_next_session/

```c
struct session * session_next_session(struct session *s, struct sort_criteria *sort_crit)
```

## Parameters

- `s` (`struct session *`)
- `sort_crit` (`struct sort_criteria *`)

## Called by

- [`cmd_switch_client_exec`](/en/tmux/latest/reference/c-function-cmd-switch-client-c-cmd_switch_client_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-switch-client.c#L117)
- [`server_destroy_session`](/en/tmux/latest/reference/c-function-server_destroy_session/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/server-fn.c#L452)

## Calls

- [`fatalx`](/en/tmux/latest/reference/c-function-fatalx/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/session.c#L291)
- [`sort_get_sessions`](/en/tmux/latest/reference/c-function-sort_get_sessions/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/session.c#L285)

## Other function references

- [`session_alive`](/en/tmux/latest/reference/c-function-session_alive/) (function)

## Referenced declarations

- [`session.name`](/en/tmux/latest/reference/c-struct-session-name/) (attribute)
- [`session`](/en/tmux/latest/reference/c-struct-session/) (struct)
- [`sort_criteria`](/en/tmux/latest/reference/c-struct-sort_criteria/) (struct)
