03-C-Functions-P - ECE 175: Introductory C for Engineers...

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

View Full Document Right Arrow Icon
ECE 175: Introductory C for Engineers Top-Down Design with Functions
Background image of page 1

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

View Full DocumentRight Arrow Icon
ECE 175: Introductory C for Engineers - Top-Down Design with Functions Designing a program Problem statement Analysis Identifying problem's data requirements (inputs, outputs, and data types) Design Initial algorithm: Write down the steps involved Algorithm refinement: If any of the step does not have an obvious solution, expand it Implementation Writing the C program Testing Comprehensive test patterns to check if your program is working correctly or not Do it yourself Go through the case study in the book on finding area and circumference of a circle 2
Background image of page 2
ECE 175: Introductory C for Engineers - Top-Down Design with Functions Library functions Predefined functions and code reuse Code reuse: Reusing program fragments that have already been written and tested C library provides several such functions Math library (math.h) Provides a set of useful mathematical functions Include math.h in the program Use the option of "-lm" when compiling (to link the math objective file) Example: Function sqrt Example Compute the distance between two given points in a plane 3
Background image of page 3

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

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

Page1 / 9

03-C-Functions-P - ECE 175: Introductory C for Engineers...

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

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