Sign in to confirm you’re not a bot
This helps protect our community. Learn more

COMP1511 - Programming Fundamentals Week 4 - Lecture 7

1:33

What did we learn last week? Code Style and Code Reviews • Making our code understandable Functions • Separating code for reuse

5:20

What are we covering today? Functions and Libraries A recap of functions Using functions from other files Arrays and 2D Arrays • A recap of arrays • Arrays inside arrays!

7:27

Recap of Functions Code outside of our main that we can use and reuse • Has a name that we use to call it • Has an output type and input parameters • Has a body of code that runs when it is called • Uses return to exit and give back its output

9:36

Why use functions? Why do we separate code into functions? Saves us from repeating code . Instead of replicating code, we can write it once • This also makes the code much easier to modify Easier to organise code

14:46

Recap of Arrays A collection of variables • Contains multiple variables all of the same type • Declared using a variable type and a size • Individual variables are accessed using an index

42:21

Accessing multiple values at once Loops and Arrays go together perfectly . Accessing all elements is a reasonably simple while loop

44:58

Two Dimensional Arrays Arrays inside arrays • Can be thought of like a grid The outer array contains arrays • Each of those is a row of the grid • Addressed using a pair of integers • All inner arrays are of the same type

54:03
Lecture 7, COMP1511 - Programming Fundamentals 2021 Term 1
Lecture 7 - Functions and Libraries, 2D Arrays We're continuing our work with both Functions and Arrays in this lecture, going back over how they work as well as adding on a bit to both concepts. In Functions, we're going to look at using functions from files we didn't write ourselves (and find that we've been doing that already for a while). Then we're going to look at putting arrays in arrays and see what we get.

Follow along using the transcript.

Marc Chee

1.61K subscribers