> Hello, I could use some help with the following C++ problems! Thank you!?

Hello, I could use some help with the following C++ problems! Thank you!?

Posted at: 2014-12-18 
Problem:

Write for each line of code in bold if its right or wrong and say why



They are all wrong.

p = x; // assigning non-pointer int to a pointer variable, and losing the pointer created by new without deleting it first

... probably should be *p = x;

int*q = x; // again assigning int to pointer. Probably should be int *q = &x;

int &c=x, &a; // the &a part declares a reference variable without initializing it.

int &b = p; // reference is not the same type as the value (int vs. int*)

int* &d = p; // attempts to declare a pointer to a reference, not allowed.

.... should be int &*d = p;

return d; // function is declared int, but return value is a (reference to a) pointer.

Problem:

Write for each line of code in bold if its right or wrong and say why