I'm trying to populate a new array with four random characters from an array containing seven characters. Is this possible? I can't seem to find the correct way to do it.
This is what I have tried but I get an error,
char charactersAllowed[] = {'a','b','c','d','e','f','g'};
char currentCharacters[] = charactersAllowed[ (int)
(Math.random() * 4) ];
error : incompatible types: char cannot be converted to char[ ]
Aucun commentaire:
Enregistrer un commentaire