Loading, please wait...

Format

Each variable declaration statement consists of a type name followed by one or more variable names. There is no limit to the number or order of variable declarations. Variable names must obey the following rules:

  1. Names can consist of letters, digits, "_"
  2. Names must start with a letter
  3. Names can start with the "_", underscore character but this is not recommended as many system macros and functions are given names in this format.
  4. Case is significant, ie. Xyz is not the same as xyz
  5. Names must be unique in the first 32 characters
  6. Names must not clash with the C reserved words:

 

Keywords

 

 

 

auto

double

int

struct

break

else

long

switch

case

enum

register

typedef

char

extern

return

union

const

float

short

unsigned

continue

for

signed

void

default

goto

sizeof

volatile

do

if

static

while

 

variable names should always be meaningful. eg.  height, length, and width are better than a, b, or c. With C's cryptic syntax it is even more important that the names are meaningful to make a program easier to follow and debug.

Examples:

char letter;

int overtime, day_of_month;

signed short int salary;

signed short salary;

short int salary;

short salary;

unsigned long hours;

float sigma_squared, X_times_2;

The 3rd, 4th, 5th and 6th examples are equivalent since signed and int are assumed if not specified.