In the next exercise, we wrote a function that takes an integer array, or rather, a pointer to it,
its size, and pointer to another function that squares the elements of the array.
And here is the expected output:
What about finding the biggest or smallest elements in arrays? We can use pointers for that
too. Let’s initialize and declare an array, use a pointer to find the greatest element in it and
print its value:
We could have also used a
version of the for loop with
incrementing the pointer, but a
while loop is simpler in this
case. We are starting fom the
first element in the array, and
then incrementing the pointer,
iterating during the whole
length of the array.
In the following example, we will take a look at simple swapping of elements. Just like in
regular examples without pointers, it is done with a variable that temporarily holds one