Home » Practice 7.1 (c- type file)

Practice 7.1 (c- type file)

1 Answer each of the following.Assume that single-precision floating-point numbers are stored in four bytes, and that the array’s starting address is location 1002500 in memory. Each part of the exercise should use the results of previous parts where appropriate.

a) Define a float array called numbers with 10 elements, and initialize the elements to the values 0.0, 1.1, 2.2, …, 9.9. Assume the symbolic constant SIZE has been defined as 10.b) Define a pointer, nPtr, that points to a float.c) Use a for statement and array subscript notation to print array numbers’ elements. Use one digit of precision to the right of the decimal point.d) Give two separate statements that assign the starting address of array numbers to the pointer variable nPtr. e) Print numbers’ elements using pointer/offset notation with the pointer nPtr.f) Print numbers’ elements using pointer/offset notation with the array name as the pointer.g) Print numbers’ elements by subscripting pointer nPtr.h) Refer to element 4 of numbers using array subscript notation, pointer/offset notation with the array name as the pointer, pointer subscript notation with nPtr and pointer/offset notation with nPtr.i) Assuming that nPtr points to the beginning of array numbers, what address is referenced by nPtr + 8? What value is stored at that location?j) Assuming that nPtr points to numbers[5], what address is referenced by nPtr –= 4? What’s the value stored at that location?

2 For each of the following, write a statement that performs the specified task.Assume that float variables number1 and number2 are defined and that number1 is initialized to 7.3.a) Define the variable fPtr to be a pointer to an object of type float.b) Assign the address of variable number1 to pointer variable fPtr.c) Print the value of the object pointed to by fPtr.d) Assign the value of the object pointed to by fPtr to variable number2.e) Print the value of number2. f) Print the address of number1. Use the %p conversion specification.g) Print the address stored in fPtr. Use the %p conversion specifier. Is the value printed the same as the address of number1?

3 Do each of the following:a) Write the function header for a function exchange that takes two pointers to floating-point numbers x and y as parameters and does not return a value.b) Write the function prototype for the function in part (a).c) Write the function header for a function evaluate that returns an integer and that takes as parameters integer x and a pointer to function poly, which represents a function that takes an integer parameter and returns an integer. d) Write the function prototype for the function in part (c)

4 Answer each of the following. Assume that integers are stored in four bytes and that the starting address of the array is at location 1002500 in memory.a) Define a five-element int array values, and initialize the elements to the even integers from 2 to 10. Assume the symbolic constant SIZE is defined as 5.b) Define a pointer vPtr that points to an object of type int.c) Print the elements of array values using array subscript notation. Use a for statement and assume integer control variable i has been defined.d) Give two separate statements that assign the starting address of array values to pointer variable vPtr. e) Print the elements of array values using pointer/offset notation.f) Print the elements of array values using pointer/offset notation with the array name as the pointer.g) Print the elements of array values by subscripting the pointer to the array.h) Refer to element 4 of values using array subscript notation, pointer/offset notation via the array name, pointer subscript notation, and pointer/offset notation.i) What address is referenced by vPtr + 3? What value is stored at that location?j) Assuming vPtr points to values[4], what address is referenced by vPtr -= 4? What value is stored at that location?

5 For each of the following, write a single statement that performs the indicated task. Assume that long integer variables value1 and value2 have been defined and that value1 has been initialized to 200000.a) Define the variable lPtr to be a pointer to an object of type long.b) Assign the address of variable value1 to pointer variable lPtr.c) Print the value of the object pointed to by lPtr.d) Assign the value of the object pointed to by lPtr to variable value2.e) Print the value of value2. f) Print the address of value1.g) Print the address stored in lPtr. Is the value the same as the address of value1?

6 Do each of the following:a) Write the function header for function zero, which takes a long integer array parameter bigIntegers and does not return a value.b) Write the function prototype for the function in part (a).c) Write the function header for function add1AndSum, which takes an integer array parameter oneTooSmall and returns an integer.d) Write the function prototype for the function described in part (c)

7 Find the error in each of the following program segments and correct the error. Assume:

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more