Question: Write a function for given main function (15pt) int* return_an_array(int n) which takes an integer n and returns a pointer to an array (allocated
Write a function for given main function (15pt) int* return_an_array(int n) which takes an integer n and returns a pointer to an array (allocated off of the heap in the function) containing the digits of n in the appropriate positions. If n = 0 return 0 (which is the "null" pointer). Recall an array name is just a pointer to the first element of the array. Use following main() to test your function. int main() { int *a = return_an_array(23542);// array of size 5 for(int i=0;i
Step by Step Solution
3.36 Rating (149 Votes )
There are 3 Steps involved in it
The purpose of this coding challenge is to find a way to return an array of size 5 with the digits of an input integer n in the appropriate positions If n is 0 then the function should return the null ... View full answer
Get step-by-step solutions from verified subject matter experts
