, , , ,

[SOLVED] Assignment 6 cop 2220

$25

File Name: Assignment_6_cop_2220.zip
File Size: 197.82 KB

Categories: , , , , Tags: , , , ,
5/5 - (1 vote)

1- (25 point) Answer each of the following. Assume that integers are stored in 4 bytes.
a) Define an array of type int called apples with five elements, and initialize the elements
to the even integers from 2 to 10. Assume the symbolic constant SIZE has been defined
as 5.b) Define a pointer aPtr that points to a variable of type int.
c) Print the elements of array values using array subscript notation. Use a for statement.
d) Give two separate statements that assign the starting address of array values to pointer
variable aPtr.e) What address is aPtr pointing to?
f) Print the elements of array values using pointer/offset notation.
g) What address is referenced by aPtr + 3? What value is stored at that location?h) Assuming aPtr points to apples[4], what address is referenced by aPtr -= 4?
What value is stored at that location?3- (25 points) Write a program to store an input list of ten integers in an array; then display a
table similar to the following, showing each data value and what percentage each value is of the
total of all ten values.Index Value % of total
0 8 4.00
1 12 6.00
2 18 9.00
3 25 12.50
4 24 12.00
5 30 15.00
6 28 14.00
7 22 11.00
8 23 11.50
9 10 5.00

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Assignment 6 cop 2220
$25