any particular reason why r=p(3,1); cout<<r; spits out 1?
note ive tested z m and t only r gives one even though its the exact same code ?
what gives ?
#include <iostream>
using namespace std;
int p(int x,int y){ //supposed to be a power operation if anyone knows how to better represent powers please guide me :)
int z;
z=x*y; // x times y =z
return z;} //return z
int main(){
int r=0; //r=0;
r=p(3,1); //value of p(3,1); = R
cout<<p<<endl; //Expected 3 got 1
cout<<p(3,1); // Expected 3 got 3 ????????
}
EDIT: Nevermind i figured out i was using the variable p instead of r