#include <iostream>
using namespace std;
int power(int x, int y){
int z;
int i;
for(i = 0; i <= y; ++i){
z *= x;
}
return(z);
}
int main() {
cout << power(2,2);
return 0;
}
This is a function that is supposed to calculate the power, however the output is 0 when it is supposed to be 4.