I have a problem with understanding this code, especially the "vet-1" part. What does it mean? What item of the array does it return?
I found this exercise while practicing for an exam in my first year of University and I wondered if it has a solution. It is not my own code. Thanks!
#include <stdlib>
#include <iostream>
using namespace std;
void change(int m, int n[7]);
int main(){
int vet[] = {1, 2, 3, 4, 5};
change(vet[4], vet-1);
change(0, &vet[4]);
int i = 0;
for (i=0; i<5; i++) cout << vet[i];
return 0;
}
void change(int m, int n[7]) {
(*(n+m))--; m++; n--;
}