Next: Customizing C and C++ indentation, Previous: Compiler error messages, Up: Common requests

### 5.20 How do I change the indentation for `switch`?

Many people want to indent their `switch` statements like this:

         f()
         {
           switch(x) {
             case A:
               x1;
               break;
             case B:
               x2;
               break;
             default:
               x3;
           }
         }

To achieve this, add the following line to your `.emacs`:

         (c-set-offset 'case-label '+)