^ is the bitwise XOR operator in C.
5 is 101 in binary representation, and 3 is 011 . So, 101 XOR 011 = 110 , which is 6 in decimal form.
You want pow(5,3) (which is available after turning on math.h , just like you). Please note, however, that it acts on non-integer pairs, so your return value will be a floating point and not at all exact. If you need an exact integer exponentiation, you need to either use an additional library or implement your own power function. This is not so difficult, for the algorithm, see squaring . Standard C does not include a function for integer exponentiation. In any case, with an integer degree of exponentiality, it is important to take care of the overflow, which can happen for small input values.
In addition, to print the returned double, you need to either convert double to int printf("%d", (int)pow(5,3)) , or print it as a floating point printf("%f", pow(5,3))
Nabla source share