assigning a rand number to each element in an array
alright, im trying to write a very simple algorithm that creates a fairly random ID for an object in a binary tree..and heres the basic coding...
Code:
while (x<4) {
node->bookID[x]=rand()%9+1;
x++;
}
any clue why it would output 0x008533cc? please, any help would be greatly appreciated. thanks a lot!
Re: assigning a rand number to each element in an array
I also think it's better to use for loops, sinse it's less confusing.
Make sure about the data type of 'x', because it should work...