In This Assignment I Would Like You Write A Few Common Pointer Algorithms You Will Need To Write Your Own Main Function 1 (36.37 KiB) Viewed 33 times
In This Assignment I Would Like You Write A Few Common Pointer Algorithms You Will Need To Write Your Own Main Function 2 (41.15 KiB) Viewed 33 times
In this assignment I would like you write a few common pointer algorithms. You will need to write your own main function that tests out these functions. Function 1: • Returns a void • Named F1 • Takes in two pointers to integers • F1 swaps the value of the two integers Example: Start (main): a = 10 b = 20 End (main): a = 20 b = 10 Function 2: • Returns an integer • Named F2 • Takes in an integer array, and integer representing the size of the array. • Iterate through the array and if any value is less
Function 2: • Returns an integer • Named F2 • Takes in an integer array, and integer representing the size of the array. • Iterate through the array and if any value is less than 10, set it to 10, if any values are greater than 20, set it to 20. • Return how many changes you had to do. Example: Start arr [3, 5, 10, 15, 35, 17, 2] = size = 7 End: arr [10, 10, 10, 15, 20, 17, 10] size = 7 Function return 4
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!