Variables and Constants
I.	What is a variable?
	A.	location in your computer memory
	B.	store values in this location
	C.	retrieve values from this location
	D.	has address
	E.	name

II.	Type of variable
	A.	tells the computer how much memory to set aside in memory to hold a variable’s value

III.	Integers
	A.	Size  of integers - use sizeof() function
	1.	int - 2bytes
	2.	short int - 2 bytes
	3.	long int - 4 bytes
		B.	Varieties of integers
	1.	int - signed
	2.	signed - either negative or positive
	3.	unsigned - always positive
IV.	Floating-point 
	A.		size

V.	Character
	A.	size - 1 byte
	B.	256 ASCII characters

VI.		Define a variable
		A.		state type
		B.		variable name
		C.		;	
		D.		variable names that tell you what the variable is 
				1.	C++ is case sensitive 
				2. 	for two word names 
					a.	use dashes
					b.  camel-notation - capitalize the first letter of the second word
				3.  can’t use key words
		E.		multiple variables  - type then variable name separated by commas

VII.		Assigning values to variables
		A.		initialization
		B.		assignment
		C.		typedef - create shorthand expression for a variable type so don’t have to type 					same thing over and over

VIII.		When to use short and long
		A.		use long if the value will be too big for its variable type
		B.		wraps around an unsigned integer - begins at 0 if it is too large
		C.		wraps around a signed integer - if too large goes to largest negtative number and 				starts over

IX.		Constants
		A.		initialized when created  and a new value can not be assigned later
		B.		symbolic constants
				1.		const - used to define constant
		C.		enumerated constants - a set of constants with a range of values
				1.		enum
				2.		type name
				3.		an open brace
				4.		each of the legal values followed by a comma
				5.		closing brace
				6.		;
				7.		each enumerated constant has a integer value, starting at 0 unless 							otherwise initialized

Back to the Main Menu