Lecture Notes for November 5, 2004 I give Dr. Conrad to use/copy/correct these notes. If you have any questions about my notes, please e-mail me: KVoit@udel.edu --------------------------------------------------------- General Notes: Exam next Wednesday Project 2 Description – - Is posted online - Due 2 weeks from today --------------------------------------------------------- What is the output? (Never answered) void p (int a, int b) { int i, j; for (i = 0; i (*max)) (*max) = array [i]; if(array [i] < (*min)) (*min) = array [i]; } } [Postscript from P. Conrad, 12/01/04: a main program to test this called p2.c is in the companion directory] Declare an array: the first 5 prime numbers. (Where 1 is neither prime nor composite.) Then call minMax on array and print results. int main(void) { int array1 [5] = {2,3,5,7,11}; int a,b; minAndMax(array1,&a,&b,5); printf("min is %d, max is %d \n",a,b); return(0); } [Postscript from P. Conrad, 12/01/04: This program is called p3.c is in the companion directory] ------------------------------------------------------- For each of the parameters indicate: call by value or call by reference? array: call by reference (Always!) min: call by reference max: call by reference size: call by value Name of array = name of pointer = address If an array has 4 elements, they are numbered: array [0] array [1] array [2] array [3] Total size = 4