Created
September 23, 2012 17:40
-
-
Save funrep/3772446 to your computer and use it in GitHub Desktop.
functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int power(int m, int n); /* is this a variable for the whole program? is it an array?, what does n and m means, they are never used in the real program so i dont get it. */ | |
main() | |
{ | |
int i; | |
for(i = 0; i < 6; ++i) /* this prints what 2 is being raised to */ | |
printf("2^%d = %3d\n", i, power(2,i)); /* this prints first 2^, then 012345,.*/ | |
return 0; | |
} | |
int power(int base, int n) /* okey now what is this? what does base stand for? */ | |
{ | |
int i, p; | |
p = 1; | |
for (i = 1; i <= n; ++i) /*i dont get this.. n was never used so what is i <= to?*/ | |
p = p * base; /* base = what? */ | |
return p; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment