If you got this version of CC Mode with Emacs or XEmacs, it should work just fine right out of the box. Note however that you might not have the latest CC Mode release and might want to upgrade your copy (see below).
You should probably start by skimming through the entire Commands chapter (see Commands) to get an overview of CC Mode's capabilities.
After trying out some commands, you may dislike some aspects of CC Mode's default configuration. Here is an outline of how to change some of the settings that newcomers to CC Mode most often want to change:
c-basic-offset or put this into your .emacs:
(setq c-basic-offset 6)
gnu style (except for Java and AWK buffers). A list of
the available styles and their descriptions can be found in
Built-in Styles. A complete specification of the CC Mode
style system, including how to create your own style, can be found in
the chapter Styles. To set your style to linux, either
customize c-default-style or put this into your .emacs:
(setq c-default-style '((java-mode . "java")
(awk-mode . "awk")
(other . "linux")))
(setq-default c-electric-flag nil)
Details of this and other similar “Minor Modes” appear in the
section Minor Modes.
(defun my-make-CR-do-indent ()
(define-key c-mode-base-map "\C-m" 'c-context-line-break))
(add-hook 'c-initialization-hook 'my-make-CR-do-indent)
This example demonstrates the use of a very powerful CC Mode (and Emacs) facility, the hook. The use of CC Mode's hooks is described in CC Hooks.
All these settings should occur in your .emacs before
any CC Mode buffers get loaded—in particular, before any call of
desktop-read.
As you get to know the mode better, you may want to make more ambitious changes to your configuration. For this, you should start reading the chapter Config Basics.
If you are upgrading an existing CC Mode installation, please see
the README file for installation details. In particular, if
you are going to be editing AWK files, README describes how to
configure your (X)Emacs so that CC Mode will supersede the obsolete
awk-mode.el which might have been supplied with your (X)Emacs.
CC Mode might not work with older versions of Emacs or XEmacs. See
the CC Mode release notes at http://cc-mode.sourceforge.net
for the latest information on Emacs version and package compatibility
(see Updating CC Mode).