class_notes11

class_notes11 - Engineering 3 Class 11 Today even more...

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

View Full Document Right Arrow Icon
Engineering 3 – Class 11 Today: • even more arrays Note: Brendon’s office hours: Today from 11-12 pm, Rm. 1117 We’ve covered: Chapters 1-4 (except 4.7) 5.1-5.7, 5.9
Background image of page 1

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

View Full Document Right Arrow Icon
• Revised version posted this morning (oops…) • In Part B, the function will need to take 2 arguments (or inputs): amount to be converted (in USD) AND the exchange rate. Homework 3
Background image of page 2
Passing Arrays to Functions • Passing arrays – To pass an array argument to a function, specify the name of the array without any brackets int myArray[ 24 ]; myFunction( myArray, 24 ); • Array size usually passed to function – Arrays passed call-by-reference – Name of array is address of first element – Function knows where the array is stored • Modifies original memory locations • Passing array elements – Passed by call-by-value – Pass subscripted name (i.e., myArray[ 3 ] ) to function
Background image of page 3

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

View Full Document Right Arrow Icon
Passing Arrays to Functions • Function prototype void modifyArray( int b[], int arraySize ); – Parameter names optional in prototype • int b[] could be written int [] • int arraySize could be simply int Example: pass_array.c
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 9

class_notes11 - Engineering 3 Class 11 Today even more...

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

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