Programming Fundamentals

Census Date

Reminder: This Sunday is Census Date, please chat to your tutor if you have any questions about it.

Part 1: Arrays Practice

In this short section, we will discuss arrays, and complete an "arrays round robin" task, to practice writing arrays.

You will use these tasks as part of this tutorial:

Setup

Odd Only (Tutor Demo)

Copy Array (Student Round Robin)

Largest Character (Student Round Robin)

Part 2: Scanning in Loops (with a fixed number of inputs)

In this section, we will write a program that scans a fixed number of values into an array.

Part 3: Scanning in Loops (with a variable number of inputs)

In this section, we will write a program that will keep scanning in values until the user presses CTRL + D.

The following line of code will be useful to begin this process:

int result = scanf("%d", &variable);

Part 4: Functions Practice

In this section, we will write a program that create functions to help us deal with colours.

The following struct will be useful for this tutorial:

struct colour {
    int red;
    int green;
    int blue;
};

Extra Tip: When to Create Your Own Functions?

In the above activity, we have seen functions created for the specific context. However, when you are creating your own functions, if you are unsure what code you should put into functions, here are some example operations that programmers often create functions for: