First page Back Continue Last page Graphics
Variables Overview, contd.
- must be declared before use
- tells the computer what type of value it should remember with a name
- declaration syntax:
- type name; // declaration is a command, so remember the semi
- int my_variable; // the “int” sets the type as integer
- if you don't declare a variable, the computer will not recognize it
- can have any name that the computer does not know already
- ex. int my_variable; // ok!
- ex. int int; // bad! the text “int” is reserved for declaration
- variable name must not contain symbols or numbers