Ok, i'm a newbie in C but wanted to learn it. I bought a book. I wrote a program to raise to a number to a certain power. This is the code:
Then i compiled it. But to test it, i dont know how to do it.
int power (int m, int n);
/* test power function */
for ( i = 0; i < 10; ++i)
printf ("%d %d %d\n", i, power(2,i), power(-3,i));
/* power: raise base to n-th power; n >= 0 */
int power(int base, int n)
int i, p;
p = 1;
for (i = 1; i <= n; ++i)
p = p * base;
I have the a.out so what should i do to execute the command and have a proper answer.
I tried ./a.out ./a.out(3,5) but it is always wrong.
Now, i can't go forward in learning as i don't know how to check a program.
Please help me