How do I raise a number by another number (num1^num2) [duplicate] - c

This question already has answers here:
The most efficient way to implement an integer based power function pow(int, int)
(21 answers)
How to raise to the power of [duplicate]
(5 answers)
Closed 8 months ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Original close reason(s) were not resolved
This is my code. I get 3^2=1. I have included the math library.
case '^':
printf("The result is %d\n",(num1^num2));
break;

Related

How can I use pow function in kernel space? [duplicate]

This question already has answers here:
2 to the power of N in C without pow
(2 answers)
The most efficient way to implement an integer based power function pow(int, int)
(21 answers)
Closed 1 year ago.
I want to do a pretty simple calculation: 2^20, but I don't have the library math.h.
How can I do it in the kernel space?

How is memory organized inside a stack frame? [duplicate]

This question already has answers here:
Explain the concept of a stack frame in a nutshell
(6 answers)
What is an application binary interface (ABI)?
(17 answers)
Closed 2 years ago.
Speaking of the order of parameters, return addresses, local variables and other block statements, how are they pushed inside the stack frame and how that particular order works? I'm having a bit of trouble understanding this concept.

Sqrt function working in c [duplicate]

This question already has answers here:
How is the square root function implemented? [closed]
(15 answers)
Closed 8 years ago.
How does sqrt function really work ? Does it go by any logical theorem to get the result.
Is there any way i can access the code of libarary function such as sqrt?
You can download the source code from the libc, which is open source: http://www.gnu.org/software/libc/download.html

Is `qsort()` really QuickSort? [duplicate]

This question already has answers here:
Quicksort implementation in C?
(1 answer)
What sorting algorithm does qsort use?
(3 answers)
Closed 9 years ago.
Silly question perhaps, but is there any guarantee that the qsort() routine in the C standard library really implements the QuickSort algorithm?
Since there is nothing in the standard that nominates QuickSort specifically, no.

sizeof(function_name) [duplicate]

This question already has answers here:
What does 'sizeof (function name)' return?
(4 answers)
Closed 10 years ago.
I tried sizeof(printf) , sizeof(foobar) etc. where foobar is a user defined function. It returns 1 without any warning or error. Why 1?
The size of functions is not well defined in C, so the value is meaningless.

Resources