Line 1: Line 1:
 +
[[Category:ECE264]] [[Category:Programming]] [[Category:C]]
 +
 +
=Lecture 12, [[ECE264]], Spring 2012, Prof. Lu=
 +
----
 
Notes for Lecture 12 - John Ribeiro
 
Notes for Lecture 12 - John Ribeiro
  
Line 64: Line 68:
  
 
   * Can be changed fro new features, bug fixes, better algorithms
 
   * Can be changed fro new features, bug fixes, better algorithms
 +
----
 +
[[2012_Spring_ECE_264_Lu|Back to ECE264, Spring 2012, Prof. Lu]]

Revision as of 04:02, 11 July 2012


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

Ph.D. on Applied Mathematics in Aug 2007. Involved on applications of image super-resolution to electron microscopy

Francisco Blanco-Silva