ENEE lecture - multiple modules and test vectors

ENEE lecture - multiple modules and test vectors - I....

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
I. Multiple Modules a. A module is a .c file. b. We can build the program in multiple .c files. This is another way of grouping things. c. Group related functions in the same .c file. d. When compiling, list all .c files. d.i. Ex. gcc chess.c board.c checkmove.c e. Move forward declarations, constants, etc into .h files “#include” into .c files that use them. Use double quotes instead of <> for them just like “tools.h”. (put function interfaces in .h file). II. Scoping (global variables) a. For global variables in multiple modules, use forward declaration. a.i. Ex. int x in one module, “extern int x” in other modules a.ii. You can put extern int x in the .h file. III. Decomposition (test and debug) a. Test Vector (checks program for bugs) a.i. A set of inputs and expected outputs. a.ii. How to run them: use < on UNIX prompt to redirect stdin from a file. a.iii. Ex. sheet < sheet_test1.in a.iv. Use “>” to redirect stdout to a file a.iv.1. Ex. sheet < sheet_test1.in > output a.iv.2. rm output first if it exists or type “sheet<sheet_test1.in>! output”
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/02/2012 for the course ELECTRICAL ENEE150 taught by Professor D.yeung during the Spring '11 term at Maryland.

Page1 / 3

ENEE lecture - multiple modules and test vectors - I....

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online