Step-wise Implementation
Step-wise Implementation

Step 1:
Sit down and look at what your program is going to need to do. Don't focus initially on thecode you will have to write. Use the Top-down Design Methodology to figure out what functions you will need and their purpose before you ever start working at the computer.

Step 2:
Create your Function Prototypes. After these are creted and before you define them, write your .h file. It should look something like this.

Step 3:
Copy your .h file to your .c file using the command cp filename.h filename.c. Then edit your .c file changing all the semi-colons to { <enter> } . All of the comments and protypes with remain the same with 2 exceptions:

So your .c file will look like this right now.

Step 4:
Now in your .c file you will create program stubs. To do this, put a printf() statement in each function and return a value if the function header statement that a value will be returned for you to do so. This makes our .c file look like this now.

Step 5:
Try compiling your .c file with this command cc -c filename.c . This will tell you if there are any errors in your program that you can fix now by just compiling that one file. Using this method will make sure that your C code is syntactically correct, but doesn't give you a way to test it. To so this you will have to build a driver.


Main Page
Last Modified 3 October 2000