C Study Guide

St. Gabriel's College



Constants are a way of storing a value that will NOT change while the program is running. You can create a constant with the following Syntax:

#define CONSTANT_NAME value

Constants are good for storing mathematical constants, Maximum sizes of things and other values that you will use many times:

#define PI 3.14159286
#define MAX_LENGTH 1000
#define THAI_CAPITAL “Bangkok”

Try it out: Constants

This program will use constants