How to?
#1

Hey I was woundering how can I do somthing like this?

rand = random(sizeof(STD[0][]));

If I try this it returns errors?

Thanks

P.S The very last bracket is the one I need to randomise I need the other to be what I enter
Reply
#2

sizeof array -> First dimension
sizeof array[] -> Second dimension
sizeof array[][] -> Third dimension
Reply
#3

(2651) : error 001: expected token: "]", but found "-integer value-"
(2651) : warning 215: expression has no effect
(2651) : error 001: expected token: ";", but found "]"
(2651) : error 029: invalid expression, assumed zero
(2651) : fatal error 107: too many error messages on one line

When I change it to this

rand = random(sizeof(STD[0]));

it gives those errors

I need to put 0 in there to say the first row then randomise the rest.
Reply
#4

Try:

rand = random(sizeof(STD[0][]));

or

rand = random(sizeof(STD[0][][]));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)