Syntax errors

The following code has syntax errors. Provide the correct code and the output. (2, 3, 6)

int *speed = new int; //Line 1

double *travelTime; //Line 2

double *distance; //Line 3

&speed = 65; //Line 4

*travelTime = 8.5; //Line 5

distance = new double; //Line 6

distance = (*speed) * (*travelTime); //Line 7

cout < *distance=””>< endl; =”” line=””>

What is wrong with the following code? (2, 3, 6)

double *firstPtr = new double; //Line 1

double *nextPtr = new double; //Line 2

*firstPtr = 62; //Line 3

nextPtr = firstPtr; //Line 4

delete firstPtr; //Line 5

delete nextPtr; //Line 6

firstPtr = new double; //Line 7

*firstPtr = 28; //Line 8

cout < *firstptr=””>< “=”” “=””>< *nextptr=””>< endl; =”” line=””>

WhatsApp
Hello! Need help with your assignments?

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X