C Programming – Declaration of variables and constants (Locally and globally)

For normal declaration of variable, a statement is like this int MAX 1000, which can be clared at the very beginning (before all functions), and become a global variable. If it’s declared within a function, it’s called local variable.

For constants, for both global constant and local constant, the statement is like this one, const int MAX 1000. In addition, there’s another way to set and replace a symbol with a predefined value. To declare such a constant (symbol), a statement like this #define MAX 1000 is used instead. #define statement can also be used to declare macro.



WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )


您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s