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

COMP1511 - Programme Fundamentals Week 3 - Lecture 6

1:57

What did we learn last lecture? Code Style and Code Reviews • Coding for and with humans Introduction of Functions • Separating code for reuse

7:43

What are we covering today? Computers as theoretical tools . Fundamentals of what a computer is • How we use memory in Arrays Using multiple variables at once

9:30

What is a computer? At the most fundamental level... • A processor that executes instructions • Some memory that holds information

11:57

Turing Machines Some images of Turing Machines • A tape and a read/write head • Some idea of control of the

17:17

The Processor We also call them Central Processing Units (CPUs) • Maintains a 'state • Works based on a current set of instructions • Can read and write from/to memory In our C Programming • State - where are we up to in the code right now • Instructions compiled from our lines of code

19:59

Memory All forms of Data Storage on a computer • From registers (tiny bits of memory on the CPU) through Random Access Memory (RAM) and to the Hard Disk Drive. All of these are used to store

23:47

There's more ... later Computers and programs are highly complex . This was just an overview . As you go through your learning you will unlock more information . For now, we have enough understanding to continue using

33:09

Arrays When we need a collection of variables together . Sometimes we need a bunch of variables of the same type . We also might need to process them all . Our current use of ints and doubles might not be able to handle this Let's take a look at our current capability...

35:57

If we want to test all these ints We'd need a whole bunch of nearly identical if statements In this situation

38:51

Arrays What is an array? . A variable is a small amount of memory • An array is a large amount of memory that contains multiple variables • All of the elements (individual variables) in an array are the same type • Individual elements don't get names, they are accessed by an integer index

41:48

Declaring an Array Similar, but more complex than declaring a variable

44:14

Array Elements . An element is a single variable inside the array • They are accessed by their index, an int that is like their address • Indexes start from 0 • Trying to access an index outside of the array will cause errors

48:26

Accessing elements in C C code for reading and writing to individual elements

50:32

Reading and Writing Printf and scanf with arrays . We can't printf a whole array . We also can't scanf a line of user input text into an array . We can do it for individual elements though! The trick then becomes looping to access all individual elements one by one

56:54
Lecture 6, COMP1511 - Programming Fundamentals 2021 Term 1
Lecture 6 - Theory of Computers and Arrays This lecture, we'll be exploring the theory (and practice) of how computers work in more detail. We'll then be extending our use of variables into arrays, collections of variables in memory. We'll be continuing with Functions also and seeing a code demo of them

Follow along using the transcript.

Marc Chee

1.61K subscribers