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 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