Question

In: Computer Science

Write a declaration to store the following values in an array rates : 12.9, 28.6, 11.4,...

Write a declaration to store the following values in an array rates : 12.9, 28.6, 11.4, 13.7, 9.5, 15.2, and 17.6. Include the declaration in a program that displays the values in the array by using pointer offset notation

Solutions

Expert Solution

#include<stdio.h>

int main(){
  
   float rate [] = {12.9, 28.6, 11.4, 13.7, 9.5, 15.2, 17.6}; //declaration to store the values
   int i;
   for(i=0;i<7;i++)
       printf("%.1f ",*(rate+i)); //pointer offset notation to display the values
      
   return 0;
}

Output

NOTE: If you want to change something , please let me know through comments; I will surely revert back to you.

Please give a up vote .....
Thank you...


Related Solutions

write a function declaration for a 2d array where each row size is 8 and the...
write a function declaration for a 2d array where each row size is 8 and the function does not return anything.
Write a function declaration for a function that sums each row of a 2D array, where...
Write a function declaration for a function that sums each row of a 2D array, where each row size is 10. The function does not return a result. IN C Program.
Given the following processing array declaration with initialisation: int[][] foo = {{1,2,3,4,5},{2,3,4,5,6},{3,4,5,6,7},{4,5,6,7,8}}; Write a loop that...
Given the following processing array declaration with initialisation: int[][] foo = {{1,2,3,4,5},{2,3,4,5,6},{3,4,5,6,7},{4,5,6,7,8}}; Write a loop that will modify  foo so it instead contains the values {{1,4,9,16,25},{4,9,16,25,36},{9,16,25,32,49},{16,25,32,49,64}}.
Programming in C++ Write a program that prints the values in an array and the addresses...
Programming in C++ Write a program that prints the values in an array and the addresses of the array’s elements using four different techniques, as follows: Array index notation using array name Pointer/offset notation using array name Array index notation using a pointer Pointer/offset notation using a pointer Learning Objectives In this assignment, you will: Use functions with array and pointer arguments Use indexing and offset notations to access arrays Requirements Your code must use these eight functions, using these...
Java programming language Array - Single identifier which can store multiple values Example initialized with values:...
Java programming language Array - Single identifier which can store multiple values Example initialized with values: int[] mySimpleArray = {4, 17, 99}; Example with fixed length but no values: int[] myFixedArray = new int[11]; The brackets identify the index. Each value has its own index number. NOTE: First element is the zeroth element: mySimpleArray[0] is 4, [1] is 17 Make a new Netbeans project called ArraysAndLoops Create the simple array with 4, 17, 99. Use System.out.println with the variable with...
In java language how would I write the following? Create an array called “boyNames” and store...
In java language how would I write the following? Create an array called “boyNames” and store all names from the BoyNames.txt file Similarly, create an array called “girlsNames” and store all names from the GirlNames.txt file Create a text menu that allowing users to:          1. Enter a name and the application must display a message indicating if the name is   among the most popular (found on either array) If the name is found, tell the user if it is a boy’s...
Write a program that uses an array of doubles initialized to whatever values you wish. Write...
Write a program that uses an array of doubles initialized to whatever values you wish. Write methods to calculate and return the minimum and a method to calculate and return the maximum value in the array. You must write YOUR ORIGINAL methods for minimum and maximum. You MAY NOT use Math class methods or other library methods. Write an additional method that accepts the array as a parameter and then creates and returns a new array with all the same...
Define an array named PeopleTypes that can store a maximum of 50 integer values that will be entered at the keyboard.
Define an array named PeopleTypes that can store a maximum of 50 integer values that will be entered at the keyboard. Enter a series of 1s, 2s,3s and 4s, into the array, where a represent an infant, a 2 represent a child, a 3 represents a teenager, and a 4 represents an adult who was present at a local school functionp.412 PE 4Write a C function that finds and displays the maximum value in a two dimensional array of integers....
Write a C++ program that uses array to store the salaries of 10 employees working in...
Write a C++ program that uses array to store the salaries of 10 employees working in a small firm. The program should take average of the salaries and the max and min salaries being paid to the employees
Write, specify and prove the function copy that copies a range of values into another array,...
Write, specify and prove the function copy that copies a range of values into another array, starting from the first cell of the array. First consider (and specify) that the two ranges are entirely separated. Note: Prototype is as below. void copy(int const* src, int* dst, size_t len){ }
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT