The above array is a declaration of an array of type integer

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

TypeofArray nameOfArray [theSizeOfArray];

For instance,

int studentMark [10];

The above array is a declaration of an array of type integer. The name of the array is studentMark, and the array is of size 10.

Arrays in C can be initialized by using a single statement that declares the array or by breaking it into two statements. In the first instance, the above array will appear as follows:

int studentMark [10] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 99};

Alternatively,

int studentMark [10];

studentMark [0] =10;

studentMark [1] =20;

An example illustrating all of the concepts above is as follows,

/* program that prints out five numbers */

#include <stdio.h>

int main ()

{

int numbers[5];

int m, n;

/*initializing array elements */

for (m =0; m<= 5; m++){

numbers[m] =m;

}

/*outputting the values in an array */

for (n =0; n <=5; n++)

{

printf ("Number [%d] =%dn", n, numbers[n]);

}

return 0;

}

}

The output from the code above appears below,

Number [0] =1;

Number [0] =2;

Number [0] =3;

Number [0] =4;

Number [0] =5;


Did you intend for your array to over write the values, it looks as though it wrote all of the numbers to the same element [0], or am I reading it wrong, which is highly possible. 

Reference no: EM13748948

Questions Cloud

Identify the extent of social media : Identify the extent of social media, if any, that is used to communicate with customers or prospects to include customer service interaction
Patient volume needed per month to cover fixed-variable cost : Monia Lee, administrative director of Digital Imaging Center, has been asked by the practice members to see if it is feasible to add more staff to support the practice;s mammography service, which currently has two digital units and two technologists..
Write a paper on fact meets fiction made-up cinematography : Write a paper on Fact meets Fiction: Made- up Cinematography & Real History? Based on the movie, Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb.
Presentation on challenges in global business environment : Challenges in the Global Business Environment PowerPoint Presentation
The above array is a declaration of an array of type integer : The above array is a declaration of an array of type integer. The name of the array is studentMark, and the array is of size 10. Arrays in C can be initialized by using a single statement that declares the array or by breaking it into two statements...
Philosophical essay : Philosophical Essay: You will write a two-part 5-6 page essay, According to Socrates, must one heed popular opinion about moral matters? Does Socrates accept the fairness of the laws under which he was tried and convicted? Would Socrates have bee..
Operating lease agreement : On January 1, 2013, Salvatore Company leased several machines from Nola Corporation under a three-year operating lease agreement. The lease calls for semiannual payments of $15,000 each, payable on June 30 and December 31 of each year. The machines w..
Using the effective interest method : On January 1, 2013, Mania Enterprises issued 12% bonds dated January 1, 2013, with a face amount of $20 million. The bonds mature in 2022 (10 years). For bonds of similar risk and maturity, the market yield is 10%. Interest is paid semiannually on Ju..
Identify key point of either jefferson or jackson presidency : Identify one of the key points of either Jefferson's or Jackson's presidency. How was it received by the general public? How did it strain relations with the Native Americans? Or other nations?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create an array of customer names

In preparation for more complex data processing tasks using object-oriented objects that you will create in up-coming units, in this unit you will utilize arrays to build some basic processing logic and structures.

  Write a version of function

Demonstrate me how to write a proper code for this problem and how to complete it

  Create a project and run the program

What is its equivalent in C++ code? Notice the similarity and differences between the codes provided below to C++ - create a project and run the program and see how it runs.

  Value referenced by the pointer.

Add 10 to the value referenced by pointer switch.Add 4 to the address stored in pointer switch.Subtract 5 from the value referenced by the pointer.

  Write a function base

Write a function base(b,x) that computes the representation of x in an arbitrary base b.

  Scenario 1: a thief enters your dwelling

Scenario 1: a thief enters your dwelling and steals your computer.is it possible likely that he steals your backup device with backup copies? how do you recover from such an incident?

  Write an iterative version and a recursive version

Write a main program that illustrates the work of your functions. E.g., if a[ ]={1,2,3,3,4,5} then 3 occurs 2 times and 7 occurs 0 times.

  Prepare a program for a bank that allows the user

Prepare a program for a bank that allows the user to enter an amount of money in cents. Show the number of whole dollars the bank will give the customer in exchange.

  Expressions until the user says

Expressions until the user says he or she wishes to end the program. For a more difficult assignment, enhance your program so that the expression need not be well formed; if it is not well formed, then the user is asked to reenter the expression.

  Calculate and return the average of one of numerical values

Write a method that uses the array to output to the console the list of entries in reverse order. Each entry is displayed on a new line.

  Write the definition of the member function two of yclass

Write the definition of the member function two of yClass so that the private member variable a is initialized to the value of the first parameter of two, and the private member variable b is initialized to the value of the second parameter of two..

  Write a program that will read in 4 test scores

Write a program that will read in a list of numbers and double each number. Your program should work for any number of lines of data.

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