Let's perform one more recipe on assertions. Let's apply assertions to ensure that a pointer is not pointing to NULL and is instead pointing to a memory address that is to be accessed. Essentially, in this recipe, we will learn to compute the average of a few numbers, where the numbers are stored in an array, and the array elements are accessed through a pointer.
Follow these steps to ensure that the pointer is not NULL and is pointing to a memory address by making use of assertions:
- Define an array containing a number of integers whose average is to be computed:
- Set a pointer to point to the array...