CS 210 ­ Fundamentals of Programming I  Spring 2012 ­ Homework 9 10 points Out: April 16/17, 2012

advertisement
CS 210 ­ Fundamentals of Programming I Spring 2012 ­ Homework 9
10 points
Out: April 16/17, 2012
Due: April 23/24, 2012 – last day of class, NO LATE WORK ACCEPTED
We will go over these homework exercises as part of the final exam review on the last day of class. Note that the material for questions 7­9 will be covered on April 18/19, 2012.
(10 points) Write C statements to do the following:
1.
2.
3.
4.
5.
6.
7.
Declare integer pointer variables named int_ptr1 and int_ptr2. Allocate an anonymous integer variable, and make int_ptr1 point to it. Inputs an integer value from the keyboard and stores it in the anonymous variable of question 2.
Display the value of the anonymous variable of question 2. Cause int_ptr2 to point to the anonymous variable of question 2. Declare a double pointer variable named double_ptr. Ask the user to enter n, the number of values to be processed; then allocate an anonymous array of n double values, and make double_ptr point to it. 8. Fill the anonymous array of question 7 with n input values, entered from the keyboard. 9. Deallocate the storage of the anonymous variable of question 2 and the anonymous array of question 8.
04/15/2012
Page 1 of 1
D. Hwang
Download