Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ language only, Please fix the code so it will compile and run without crashing. Should be 3 problems and additions and/or modifications you'll need

C++ language only,

Please fix the code so it will compile and run without crashing.

Should be 3 problems and additions and/or modifications you'll need to complete.

#include using namespace std; int main(int argc, char **args) { int *ptr, *current; const int SIZE = 5; ptr = new int[SIZE]; int value[SIZE]; ptr = current = value;

for (int i = 0; i <= SIZE; i++) value[i] = i * 2; for (int i = 0; i < SIZE; i++) { cout << *ptr << endl; ptr++; }

cout << *(--ptr) << endl; for (int i = 0; i < SIZE; i++) { cout << *current << endl; current++; }

cout << *(ptr) << endl; cout << *(- -current) << endl;

for (int i = 0; i <= SIZE; i++) *(ptr++) = i * 2;

for (int i = 0; ptr <= &value[SIZE - 1]; ptr += 1) *ptr = i++ * 2;

ptr- -; cout << "The value where pointer 'ptr' pointing to is: " << *ptr << endl;

return 0; }

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 Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Draw the shear and moment diagram for thebeam. A 1/2- L B W C

Answered: 1 week ago

Question

Am I staying angry at someone, hoping to make him or her feel bad?

Answered: 1 week ago

Question

4. What actions should Bouleau & Huntley take now?

Answered: 1 week ago