Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a. This program is supposed to write 30 20 10, but it doesn't. Find all of the bugs and show a fixed version of the
a. This program is supposed to write 30 20 10, but it doesn't. Find all of the bugs and show a fixed version of the program:
int main()
{
intarr[3]={5,10,15}; int* ptr = arr; *ptr = 10; // set arr[0] to 10 *ptr + 1 = 20; / set arr[1] to 20 ptr += 2; ptr[0] = 30; // set arr[2] to 30
while (ptr >= arr)
}
ptr--; cout << ' ' << *ptr; // print values }
cout << endl;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started