Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions