hi
actually im reading a book about C.
in this book there is a lesson called functions.
i guess that n is going to be the exponent of m so far.
the following code is directly from the book:
Code:
#include<stdio.h>
int power ( int m, int n);
main ()
{
int i;
for (i=0; i<10;++i)
printf("%d %d %d\n", i, power(2, i), power(-3, i));
return 0;
}
int power(int base, int n)
{
int i, p;
p=1;
for(i=n;i<=n;++i)
p = p * base;
return p;
}
i need help with this code because i dont understand it.
an explanation of the whole code line by line would be very appreciated.
threadhead