Hello im learning c++ for my exam and we have a program written on paper and we have to write what program returns im having problems with pointers and functions
i know how it works until: cout << *(++c) << endl; c++; cout << *c << endl; c--; cout << *c << endl;
here is the code:
#include <iostream>
using namespace std;
void Ac (int& x, int &y) { y+=2; x=y-1;};
void Dc (int x, int y) { y-=2; x=y+1;};
int main ()
{
int a=2, i=-2, v=3, e=8, f=4, b[]={3,6,9,1,4,7,2,5}, *c=b;
cout << "a\n" << a << endl;
cout << a-- << endl; cout << a << endl; cout << --a << endl;
for (int i=1; i<(a+4); i++)
cout << b[i] << endl;
cout << *(++c) << endl; c++; cout << *c << endl; c--; cout << *c << endl;
while (i<=0)
{
v-=i;
cout << v+2 << endl; i++;
}
Ac (e,f); cout << e << endl << f << endl;
Dc (e,f); cout << e << endl << f << endl;
Ac (f,e); cout << e << endl << f << endl;
return 0;
}
Also, what does y += ++x
do ? (not in this program)