Author Question: What will the following code output?int *numbers = new int[5];for (int i = 0; i (Read 23 times)

ashley

  • Hero Member
  • *****
  • Posts: 584
What will the following code output?
int *numbers = new int[5];
for (int i = 0; i <= 4; i++)
    *(numbers + i) = i;
cout << numbers[2] << endl;

3
1
◦ five memory addresses
2
0



Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
 

Did you know?

The term pharmacology is derived from the Greek words pharmakon("claim, medicine, poison, or remedy") and logos ("study").

Did you know?

In Eastern Europe and Russia, interferon is administered intranasally in varied doses for the common cold and influenza. It is claimed that this treatment can lower the risk of infection by as much as 60–70%.

Did you know?

People who have myopia, or nearsightedness, are not able to see objects at a distance but only up close. It occurs when the cornea is either curved too steeply, the eye is too long, or both. This condition is progressive and worsens with time. More than 100 million people in the United States are nearsighted, but only 20% of those are born with the condition. Diet, eye exercise, drug therapy, and corrective lenses can all help manage nearsightedness.

Did you know?

An identified risk factor for osteoporosis is the intake of excessive amounts of vitamin A. Dietary intake of approximately double the recommended daily amount of vitamin A, by women, has been shown to reduce bone mineral density and increase the chances for hip fractures compared with women who consumed the recommended daily amount (or less) of vitamin A.

Did you know?

Bisphosphonates were first developed in the nineteenth century. They were first investigated for use in disorders of bone metabolism in the 1960s. They are now used clinically for the treatment of osteoporosis, Paget's disease, bone metastasis, multiple myeloma, and other conditions that feature bone fragility.

For a complete list of videos, visit our video library