Print element of array number using array subscript notation

Assignment Help C/C++ Programming
Reference no: EM131608579

Answer each of the following.

Assume that single-precision floating-point numbers are stored in 4 bytes, and that the starting address of the array is at location 1002500 in memory. Each part of the exercise should use the results of previous parts where appropriate.

a) Define an array of type float 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 an object of type float.

c) Print the elements of array numbers using array subscript notation. Use a for statement and assume the integer control variable i has been defined. Print each number with 1 position 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 the elements of array numbers using pointer/offset notation with the pointer nPtr.

f) Print the elements of array numbers using pointer/offset notation with the array name as the pointer. g) Print the elements of array numbers by subscripting pointer nPtr.

h) Refer to element 4 of array 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?

Reference no: EM131608579

Questions Cloud

Discuss problem related to the pointer : The address operator (&) can be applied only to constants, to expressions and to variables declared with the storage-class register.
Analysis paper based on the movie my big fat greek : Write a five page analysis paper based on the movie My Big Fat Greek Wedding on 1) connection with intercultural communication patterns and concepts
Who might you use for regular pepsi : Who might you use for regular Pepsi? Diet Coke? Coke Classic? Sprite? Explain and justify your choice for each.
What are the benefits of public radio : Commercial radio became the norm in the United States, whereas many other countries adopted a publicly-owned model used for education and culture.
Print element of array number using array subscript notation : Assume that single-precision floating-point numbers are stored in 4 bytes, and that the starting address of the array is at location 1002500 in memory.
How did the family viewing experience differ : how did the family viewing experience differ? What effects did this have on families - As these programs became visual
Differences between the coverage in forms of media : analysis of the similarities and differences between the coverage in forms of media. Include speculations about the reasons for the differences
Print the value of the object pointed to by fptr : For each of the following, write a statement that performs the indicated task. Assume that floating-point variables number1 and number2 are defined.
Write the function header for a function called exchange : Write the function header for a function called exchange that takes two pointers to floating-point numbers x and y as parameters and does not return a value.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd