pointers

need to write 3 functions: 1)main 2)int mod_test(int a, int e, int n)
3)void mod_test(int a, int x, int b, int y, int n, int *out1, int *out2)*out1 here means output, so there are 2 outputs; these functions simply attempt to solve the issue of overflow; not sure how to implement 3) which declares 2 pointers as parameters: should I use nested while loops; just not sure!! Below is the code for 2):

int mod_test(int a, int e, int n) //a to the e mod n: a^e mod n
{
int i = 0;
int result = 1;
while(i < e)
{
result = result * (a % n);
i++;
}
return result;
}


Topic archived. No new replies allowed.