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

  Full program using c programming language

(a) Write a pseudo-code to solve this problem. (b) Write a full program using C programming language to solve this problem.

  Write a program that requires the number of bits

Write a program that requires the number of bits for the exponent and significant of a floating point representation, then requires two decimal real numbers and an operation, sum, subtraction or multiplication.

  Authentication method for android

For the fourth program under Connector for Pi to be able to (Connect between File Handle and Client+Server socket program).

  Input parameters, and returns nothing

Write a function called ten2one(), that takes no input parameters, and returns nothing (void). The body of the function must include a loop that counts from 10 down to 1, printing the count value each time in the loop. The output should look like (no..

  Using opengl to create a cube

Write a program in C/C++ using OpenGL to create (without using built in function) a cube by implementing translation algorithm by translating along 1. X-axis, 2.Y-axis and 3. X and Y plane

  Implement the delivery company using the classes given in

implement the delivery company using the classes given in the class diagram above. construct a cpp file named

  Provide a makefile to compile your code

You are to implement a Virtual Memory Manager in C or C++ and submit the source code, which we will compile and run. Please provide a Makefile to compile your code and submit as a single tar, tar.Z, tar.bz2, zip file through NYU classes

  Development of a unix peer-to-peer file transfer application

This assignment aims to assess your C programming skills and forms the second phase of the development of a UNIX peer-to-peer file transfer application

  Create class integerset

Create class IntegerSet for which each object can hold integers in the range 0 through 100. Represent the set internally as a vector of bool values. Element a[i] is true if integer i is in the set. Element a[j] is false if integer j is not in the set..

  Program to tests whether they form a magic square

Write a program that reads n2 numbers from standard input and tests whether they form a magic square when put into matrix form.

  Program should read in the file and place periods

Create a C++ program that will read this file and correct errors in the English syntax of the file. The program should Read in the file and Place periods at the end of all sentences throughout this file

  Write a header for the function named subtract

Write a header for the function named subtract. Subtract returns nothing and has one double parameter named num.

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