JeTmAn81
Member
Got very flustered at an exam. Was supposed to be an example for a power function as a small side part of a question, not necessarily important to the question itself. Sooo, I forgot to keep the base and just foolishly do this:
Whyyyyy did I do this . So much shame coursing through my body right now.Code:for(int i = 0; i < exp; i++) { pow = pow * pow; } return pow;
It's ok, I don't think that code would work right even if you set the base. There's no zero case, and you're doing extra multiplication.