Will the above function compile in c++


C++ allows pointers to stack-dynamic variables. Consider the following C++ function:

int twice(int x)
{
int *y;
*y = x * 2;
return *y;
}
Will the above function compile in C++? Is it correct? If not, under what circumstances will it fail and how should it be corrected? Consider one other language that has pointers. Does that language have the same problem? Explain.

since the code complies, could you possibly alter the code a little (i.e. make the pointer incorrect) so that it wouldn't compile. That way I can answer the question by saying yes, this works but if "this" were different it wouldn't. And the reason why is.... *insert reason

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Will the above function compile in c++
Reference No:- TGS079138

Expected delivery within 24 Hours