1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nalin [4]
3 years ago
15

Suppose that a is declared as an int a[99]. Give the contents of the array after the following two statements are executed: for

(i = 0; i <99 ; i++) a[i] = a[a[i]];
Computers and Technology
1 answer:
mr_godi [17]3 years ago
5 0

Answer:

Each array position holds the position from which the information is going to be retrieved. After the code is run, each position will have the information retrieved from that position.

Explanation:

The best way to solve this problem is working as if we had a very small array. Then we can generalize for the large array.

For example

int a[3];

a[0] = 1; a[1] = 2; a[2] = 0;

for(i = 0; i < 3; i++)

a[i] = a[a[i]];

When i = 0, we have:

a[i] = a[a[i]] = a[a[0]] = a[1] = 2;

When i = 1, we have

a[i] = a[a[i]] = a[a[1]] = a[2] = 0;

When i = 2, we have

a[i] = a[a[i]] = a[a[2]] = a[0] = 1;

Basically, in our small example, each array position holds the index from which we are going to retrieve the information. The same is going to happen in the array of length 99. After the code is run, each position will have the information retrieved from that position

You might be interested in
How to transfer photos from iphone to iphone?
STALIN [3.7K]
If you have icloud then you can transfer them.
7 0
3 years ago
Read 2 more answers
Prostate cancer can physically affect both men and women
Naddika [18.5K]
Correct but men are more prone to it.
7 0
3 years ago
The internet may best be compared to a
liraira [26]
I would say a calculator.
7 0
3 years ago
Read 2 more answers
30 POINTS!!
Snowcat [4.5K]

Answer:

paragraph or by a break line space

5 0
3 years ago
Is a Local Area Network (LAN) for use by everyone within an organization or company
Anna007 [38]
LAN is local area network or Ethernet connections and yes if all the computers are connected by Ethernet cables then they are
8 0
3 years ago
Other questions:
  • If an occupation is projected to grow by 13% over the next 10 years, how would you rate the job outlook?
    7·2 answers
  • If the current through a heater coil is 5 amp and the supply voltage is 120 volts, the coil resistance is A. 0.04 ohm. B. 24 ohm
    6·1 answer
  • Which of the following devices is used to connect a computer to a network
    7·1 answer
  • On sites that use "cloud computing," how is your information being stored?
    13·1 answer
  • When building systems, the only two entities that constitute software engineering are people and process.
    9·1 answer
  • When I try to invite someone to be my friend on brainly, for some people, it says, "Somethings up. Invitation wasn't sent". Can
    8·1 answer
  • Select the correct answer
    11·1 answer
  • You are the administrator of a Windows network. When creating a new user account, you specify a security clearance level of top
    8·1 answer
  • Which act requires that financial institutions must provide a privacy notice to each consumer that explains what data about the
    12·1 answer
  • If I write too much for an exam answer, do I get downgraded?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!