{
int array[SIZE];
int *Shifted;
int size, i;
cout << "Enter size of array: " << endl;
cin >> size;
cout << "Enter elements: ";
for(i=0;i<size;i++)
{
cin >> array[i];
}
for (int index = 0; index < i; index++)
{
cout <<"Here is array that you just enter " << index << endl;
}
Shifted=Shifted_array(array,size);
cout << "The elements after shifting the array: " << endl;
for(i=0;i<size+1;i++)
{
cout << *(Shifted+i) << endl;
}
}
See, the problem is, that array size has to be determined at compile time. If you want to create an array which size will be decided on run time(e.g. user will tell you how big array should be), then you need to use dynamic allocation(using pointers and new keyword). I suggest you to read about arrays, and then about creating dynamic arrays.
Also, the for loop at line 13 will not work as intended. It will simply print out numbers from 0 to i-1. This is not what you wanted to do. Try to fix it as an exercise :)
(also, if you've got good reasons to believe that `i' would not be equal to `size' after line 12, then perhaps you should consider to change their names)
Your program is working perfectly, because you know how it is supposed to be used. Try to say that size of array will be SIZE + 1(so, if you set SIZE previously to 11, you will input 12. If it was 3, then you input 4, etc.). And look at your program failing, because you try to access memory address you're not supposed to access.