CS1411 - 160 - Programming Principles I, Spring 2005
Lab assignment 9
Motivation
This weeks you will practice basic pointers
Mandatory work
Your TA will check that you have done the following things (you may leave once their done) :
Simple Pointer Program
Write a simple program that declares a int variable a and initializes it with the value 10. Declare an int-pointer, and initialize it with the address of a. Modify a, but not through a but by using your pointer. Display the value of a and the memory address of a, but again by using only the pointer variable, not a.
Dynamic array
Write a program that will ask how many numbers to input, let the user input that many numbers, store them. Then, in a second loop add all the numbers, and display the total sum afterwards. Use a dynamic array for the implementation (new[] and delete[]). Make sure you delete it after use.
How?
Please check the labs page on how to get started. There are instructions for visual studio (use version 6) and XCode
Please give the Macs a try. If you simply cannot work with them, go to PE 119, but let your TA know.
Sample programs
have moved to the examples page
Help!
For help: ask your TA! He is here to help you!
If the instructions are unclear or you have any other questions, please email me