Posts

Showing posts from April, 2012

Storage Classes in C

STORAGE CLASSES A storage class defines the scope (visibility) and life time of variables and/or functions within a C Program. There are following storage classes which can be used in a C Program auto register static extern auto - Storage Class auto  is the default storage class for all local variables. { int Count; auto int Month; } The example above defines two variables with the same storage class. auto can only be used within functions, i.e. local variables. register - Storage Class register  is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and cant have the unary '&' operator applied to it (as it does not have a memory location). { register int Miles; } Register should only be used for variables that require quick access - such as counters. It should also be noted that

Small Game in C Language

////////////////GAME//////////////////////// /********************************************************************** *********************************************************************** *********************************************************************** *REVERSI                                                        ******* *                                                                ******* *You can go first on the first game, then we will take turns.    ******* *   You will be white - (O)                                        ******* *   I will be black   - (@).                                    ******* *Select a square for your move by typing a digit for the row    ******* *and a letter for the column with no spaces between.            ******* *********************************************************************** *********************************************************************** ***********************************************************************/ #include <