In C++, write a method that compute squares using pointers

All About Code
1 min readMay 22, 2022

Question

Create a method that takes in a reference int and an int array. Return the memory address of the first element of the array.

Explanation

Within the computerSquares function, create a for loop that loops from 0 to the length of the array, n. Within the for loop, assign the value ((k+1)²) into the current element the for loop is iterating at. Once the for loop has finished iterating, then return the memory address of the first element of the array &arr[0].

--

--