Presentation is loading. Please wait.

Presentation is loading. Please wait.

Variables and constants Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences.

Similar presentations


Presentation on theme: "Variables and constants Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences."— Presentation transcript:

1 Variables and constants Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 5 October 2004 Chapter 3

2 Variable and memory  Binary  Byte  Bit  RAM  sizeof Ex3-1

3 Variable types  Table 3.1 char int float double  Adjective signed  unsigned short  long  Naming Hungarian + Camel-notation Case sensitive

4 Declare and initialize  Declare before use  Two ways of initialization Always initialize a variable and ask what would its value be later on Ex3-2  typedef Ex3-3  Wrapping around an unsigned integer Ex3-4  Wrapping around an signed integer Ex3-5

5 Characters  Character  number ASCII Ex3-6  Special printing characters Table 3.2

6 Constants  Two types Literal constant Symbolic constant  Two ways of defining a constant #define const  Enumerated constant enum Started from 0, 1, 2, … Ex3-7


Download ppt "Variables and constants Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences."

Similar presentations


Ads by Google