Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mod Calculation with an Array

Status
Not open for further replies.

Jodi999

Programmer
Feb 24, 2004
10
US
I am looking to take:

INT32 num[45];
INT32 mod[3];
INT32 ans[4];

(the num and mod arrays get set to values here)

I've tried:
ans = num % mod;
&ans[0] = (INT32*)(num & mod);

...but can't get it to work. Is it possible to do a mod calculation using arrays for all of the operands?
 
Well you are trying to take a modulus between two arrays, which doesn't really make sense.

Maybe this will give you an idea of what you can do :

Code:
int main() {
        int arr[2];
        int arr2[2];

        arr2[0] = 52;
        arr2[1] = 2;

        arr[0] = arr2[0] % arr2[1];
        arr[1] = arr2[0] / arr2[1];
        printf("\nArr[0] is %i", arr[0]);
        printf("\nArr[1] is %i \n", arr[1]);
}

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top