---
title: 2.7 default Label
description: "The `default` label defines the block executed when none of the `case` labels in a `switch` statement matches the controlling expression. ``` #include int main() { int number = 5; switch (number) { case 1: printf(\"One\\n\"); break; case 2: printf(\"Two\\n\");…"
url: "https://edcret.in/docs/c-programming/control-flow/2-7-default-label/"
updated: "2026-09-06"
category: C Programming / Control Flow
---

# 2.7 default Label

The `default` label defines the block executed when none of the `case` labels in a `switch` statement matches the controlling expression.

```
#include <stdio.h>

int main()
{
    int number = 5;

    switch (number)
    {
        case 1:
            printf("One\n");
            break;

        case 2:
            printf("Two\n");
            break;

        case 3:
            printf("Three\n");
            break;

        default:
            printf("Other number\n");
    }

    return 0;
}
```

### Example Output

```
Other number
```

### Explanation

The `switch` expression contains the value `5`:

```
switch (number)
```

There is no `case` label with the value `5`, so none of the `case` blocks is selected.

Execution therefore continues at the `default` label:

```
default:
    printf("Other number\n");
```

The `default` label is optional. A `switch` statement can contain no `default` label, in which case execution continues after the `switch` when no case matches.

The `default` label does not have to appear at the end of the `switch`, although placing it there is conventional.
