Revision as of 04:02, 11 July 2012 by Rhea (Talk | contribs)


Lecture 12, ECE264, Spring 2012, Prof. Lu


Notes for Lecture 12 - John Ribeiro

for ( direction = 0 ; direction < 4 ; direction ) {

 if ( can move forward )
 {
   go forward
 }
 // Book keeping so you know where you are

}

 go backward

/* When all four direction have led to a dead end */

Above is a sample template in order to solve ipa1-2.

  • Compiler copies attribute by attribute *

Construct Frame:

c 11 b 6 a 3 value address return address

Main Frame:

v1.z = 200 + sizeof ( int ) * 2 11 v1.y = 200 + sizeof ( int ) * 1 6 v1.x = 200 3

Copy the values => *C has only pass by value / call by value

                  *C does not have call by reference

For ipa1-2

- Read the maze and store it in memory - Find where you can move to - Move to the place and mark your earlier location as invalid so you do no return - Keep moving until reaching the exit

Create maze structure containing the following

- Current Row/Col - Start Row/Col - Exit Row/Col - char ** maze

if ( currentRow == exitRow && exitCol = currentCol ) (

 done;

}

  • Structure's name NOUN w/ Capital Letter
  • Function VERB w/ lower case letter

ADVANTAGES OF STRUCTURES

- Cluster related data into an "object" - Better organization and easier to understand - Easier to make changes.

 * Can be changed fro new features, bug fixes, better algorithms

Back to ECE264, Spring 2012, Prof. Lu

Alumni Liaison

Followed her dream after having raised her family.

Ruth Enoch, PhD Mathematics