20.09.2015 Views

Programming in C

Kochan - ProgramminginC

Kochan - ProgramminginC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6.0 Storage Classes and Scope<br />

453<br />

Table A.6<br />

Variables: Summary of Storage Classes, Scope, and Initialization<br />

If Storage And Variable Then it can be And can be<br />

Class is is declared referenced <strong>in</strong>itialized with Comments<br />

static Outside any Anywhere Constant Variables are<br />

BLOCK with<strong>in</strong> the file expression only <strong>in</strong>itialized<br />

Inside a BLOCK With<strong>in</strong> the only once at<br />

BLOCK<br />

the start of program<br />

execution;<br />

values are<br />

reta<strong>in</strong>ed through<br />

BLOCKs;<br />

default value is 0<br />

extern Outside any Anywhere with<strong>in</strong> Constant Variable must<br />

BLOCK the file expression only be declared<br />

Inside a BLOCK With<strong>in</strong> the <strong>in</strong> at least<br />

BLOCK<br />

one place without<br />

the extern<br />

keyword, or <strong>in</strong><br />

one place us<strong>in</strong>g<br />

the keyword<br />

extern and<br />

assigned an <strong>in</strong>itial<br />

value<br />

auto Inside a BLOCK With<strong>in</strong> the Any valid Variable is<br />

BLOCK expression <strong>in</strong>itialized each<br />

time the<br />

BLOCK is<br />

entered; no<br />

default value<br />

register Inside a BLOCK With<strong>in</strong> the Any valid Assignment<br />

BLOCK expression to register not<br />

guaranteed;<br />

vary<strong>in</strong>g restrictions<br />

on types of<br />

variables that<br />

can be declared;<br />

cannot take the<br />

address of a register<br />

variable;<br />

<strong>in</strong>itialized each<br />

time BLOCK is<br />

entered; no<br />

default value

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!