Variable Types in C: Auto, Static, Register and External – A Brief Guide

A Technophile's Indulgence

Apart from the regular types that a variable may have, like int, float, char, et cetera, there are a set of other qualifiers which may be added onto this in order to give the variable scope of the variable, whether that is local or global. A variable may have only one of these additional qualifiers at once.

The first of these types is auto, and it isn’t terribly interesting. Indeed, the auto type is very rarely specified, as it is the default for any place where the declaration is legal, and invalid elsewhere. An auto variable has local variable scope, meaning that it is only “visible” or can only be accessed and changed within the function or block in which it is declared. An auto variable disappears when it goes out of scope, freeing the memory which it was declared with, and any subsequent declaration of…

View original post 1,141 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s