jeudi 16 juillet 2015

why using the value of int i; is undefined behaviour but using the value of rand() is not?

if I don't initialise i, I don't know value of i, but also I cannot predict the value of rand(),

but at other side, I know the value of uninitialised i is between INT_MIN and INT_MAX, also I know the value of rand() is between 0 and RAND_MAX,

why using the value of uninitialised i is undefined behaviour but using the value of rand() is not?




Aucun commentaire:

Enregistrer un commentaire