Hi,
I think your powerfunc is totally wrong. I suppose you want to do some 2^4 = 2 * 2 * 2 * 2.
So you should be doing
Edit : By the way in your original code num will always be 2 and orignum will always be 2 so num = num *orignum will always be 2 * 2 = 4.Code:ULONG powerFunc(USHORT num, USHORT pow) { if (pow < 1) return 1; else return num * powerFunc(num, --pow); }