Discussion Notes 4

Discussion Notes 4 - EME 5 Discussion 4 Function Random...

This preview shows pages 1–7. Sign up to view the full content.

EME 5 Discussion 4 Function Random Number Generation Define Macros Header, Function, and Application Files

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

View Full Document
Function (a) Function prototype : returntype functionname(argumenttype [argumentname]); (b) Function definition : returntype functionname(argumenttype argumentname) { statements; return returnvalue; }
Function (contd.) (c) Common errors : 1) returnvalue does not have the type that matches returntype 2) functionname in definition does not match functionname in prototype 3) argumenttype/argumentname in definition does not match argumenttype/argumentname in prototype

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

View Full Document
Function (contd.) In Ch, write a function that returns the value of f(x). Print the values of f(x) for -10<=x<=10 with x_step = 0.5. Plot f(x) with 50 points for x. f(x)=sin(x).
Function (contd.) Need: 1) for-loop 2) Ch plotting function fplotxy() int fplotxy(double (*func)(double), double x0, double xf, int num, char *title, char *xlabel, char *ylabel);

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

View Full Document
Function (contd.) #include <math.h> #include <stdio.h>
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2008 for the course EME 005 taught by Professor Cheng during the Fall '07 term at UC Davis.

Page1 / 12

Discussion Notes 4 - EME 5 Discussion 4 Function Random...

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

View Full Document
Ask a homework question - tutors are online