|
||||||||||
copyright © 2006 Don Southwell - All rights reserved |
|
||||||||||
copyright © 2006 Don Southwell - All rights reserved |
Pointers Lab Pointers are often used for array processing. Write a program that allocates an array large enough to hold a user defined number of integers. Create a pointer and make it point to the array. Once all the integers are entered, the array pointer should be passed to a function that uses the pointer to output the sorted array. Input Validation: Do not accept negative numbers for integers. Input Data: User enters number of integers first: (ex: 12) Then user enters integers: (ex: 75, 81, 45, 32, 89,16, -2, 21, 56, 98, 11, 27, 19) Reminders: Processing an array can either be done with indexes or pointers. Here is a simple code example using both:
************************************************************* Bonus Option (+3 on next exam) : Add a slideLeft function using pointers that moves the first element in the array to the last index and moves all other elements to the left one index. Disply the array before the slide left and after. ******************************************************************************************** Suggested structure for your program: (a little algorithmic assistance..) // Name: // Program Description // Function prototypes int main() {
} //******************************************** void display(int *iPtr, int size) // Insert code to display sorted array. } Turn-in for lab credit a single document with: Source Code Screen Shot(s) with test input. |
! You are using a version 4 browser or older. If you are experiencing any problems with scrolling, please reload the page.