Write a function `average()`

that receives 3 arrays as parameters.
The function computes the individual averages of the first two arrays (one average for each row of the arrays).
The averages are stored in the third array.
Compute and display the average of arrays `grades1`

and `grades2`

:

grade[0] = 10.10 grade[1] = 11.25 grade[2] = 14.25 grade[3] = 9.90 grade[4] = 11.60 grade[5] = 11.05

Write a function `globalAverage()`

that receives an array as parameters and returns the mean of this array.
Using the function, calculate and display the average of the array `grades1`

:

Average: 12.72

Write a function `void copy(const float src[], float dest[], int size);`

which receives 2 arrays as parameters.
This function copies all the values of the array `src`

into `dest`

.
With this function, copy the array `grades1`

into `grades2`

. Check by displaying `grades2`

:

grade[0] = 10.20 grade[1] = 12.50 grade[2] = 18.50 grade[3] = 9.80 grade[4] = 13.20 grade[5] = 12.10

Write a function `int compare(const float t1[], const float t2[], int size);`

which receives 2 arrays as parameters.
This function counts the number of elements with the same index and the same value in both arrays.
Test the function with the following arrays:

```
float grades1[NB_NOTES] = {10.2, 12.5, 18.5, 9.8, 13.2, 12.1};
float grades2[NB_NOTES] = {15.7, 12.5, 15.3, 9.8, 10.8, 12.1};
```

There are 3 identical grades.

Write a function `equal()`

that receives 2 arrays as parameters. This function returns :

`1`

if both arrays are strictly identical;`0`

otherwise.- Compare the arrays
`grades1`

and`grades2`

before and after copying :

Before copy : arrays are different. After copy : the arrays are identical.

Write a `maxTab()`

function that receives an array and its size as parameters. The
function returns the largest value of the array.

`int maxTab(int tab[], int size);`

The largest value of the array is: 98

Write a function `argmax()`

that receives an array and its size as parameters. The
function returns the first index of the smallest element of the array.

`int argmax(int tab[], int size);`

The first index of the smallest element of the array is: 2

Write a `sort()`

function that receives an array and its size as parameters. The
function sorts the array in ascending order.

`void sort(int tab[], int size);`

To do this exercise, you can use by the bubble sort, whose algorithm is presented on the page Wikipedia. Here is the result of the sort:

Initial array : 12 54 0 18 8 98 5 16 58 4 75 5 Sorted array : 0 4 5 5 8 12 16 18 54 58 75 98

- Learn C programming
- Lesson 1.1. History of C programming language
- Lesson 1.2. First program
- Lesson 1.3. Compilation
- Lesson 1.4. Preprocessor directives
- Lesson 1.5. Which compiler to choose?
- Lesson 1.6. Flowchart
- Lesson 2.1. Types and variables
- Lesson 2.2. Integers
- Lesson 2.3. Floating point numbers
- Lesson 2.4. Characters
- Lesson 2.5. Variables initialization
- Lesson 2.6. Ariane flight 501
- Lesson 3.1. Arithmetic operators
- Lesson 3.2. modulo
- Lesson 3.3. Operators and types
- Lesson 3.4. Type casting
- Lesson 3.5. Bitwise operators
- Lesson 3.6. Bitwise operators details
- Lesson 3.7. Shifting operators
- Lesson 3.8. Assignment operators
- Lesson 3.9. Increment and decrement operators
- Lesson 3.10. Comparison operators
- Lesson 3.11. Logical operators
- Lesson 3.12. Operator precedence
- Lesson 4.1. printf
- Lesson 4.2. scanf
- Lesson 4.3. putchar
- Lesson 5.1. Conditional branching (if...else)
- Lesson 5.2. Nested if and indentation
- Lesson 5.3. Checking intervals
- Lesson 5.4. Ternary Operator ?:
- Lesson 5.5. switch..case statement
- Lesson 5.6. Break keyword in switch..case
- Lesson 6.1. do..while loop in C
- Lesson 6.2. While loop in C
- Lesson 6.3. For loop in C
- Lesson 6.4. How to choose the right loop in C ?
- Lesson 6.5. Exercices on loops in C
- Lesson 7.1. Bit masking
- Lesson 7.2. Bit masking, how to clear a bit in C?
- Lesson 7.3. Bit masking, how to set a bit in C?
- Lesson 7.4. Bit masking, how to toggle a bit in C?
- Lesson 7.5. Bit masking, how to check a single bit in C?
- Lesson 7.6. Overview of bit masking
- Lesson 8.1. Basic syntax of C functions
- Lesson 8.2. Calling C functions
- Lesson 8.3. Void keyword
- Lesson 8.4. Return keyword
- Lesson 8.5. Variable scope
- Lesson 8.6. Global variables
- Lesson 8.7. Static variables
- Lesson 8.8. Random numbers in C
- Lesson 8.9. Mathematical functions in C
- Lesson 9.1. Syntax of C arrays
- Lesson 9.2. Array initialization
- Lesson 9.3. Multidimensional arrays
- Lesson 9.4. How C arrays are stored in memory?
- Lesson 9.5. Arrays and functions
- Lesson 10.1. Strings in C
- Lesson 10.2. Null terminated string
- Lesson 10.3. The string.h library
- Lesson 10.4. String and functions
- Lesson 11.1. Introduction to pointers in C
- Lesson 11.2. Syntax of C pointers
- Lesson 11.3. Dynamic memory allocation
- Lesson 11.4. Incrementing pointers
- Lesson 11.5. Pointers as function argument in C
- Lesson 12.1. Introduction to structures in C
- Lesson 12.2. Properties of structures in C
- Lesson 12.3. Structures and pointers
- Lesson 12.4. Structures and functions
- Lesson 13.1. Recursive functions in C
- Lesson 13.2. Depth of recursive functions
- Lesson 13.2. Mutual recursion
- Lesson 14.1. Additional exercises

Last update : 11/25/2022