I have the following function which aims to return a 16 character long alphanumerical string composed of 62 characters char type alphanumeric() function can return (A-Z, a-z alongside numbers 0-9).
string random() {
string code;
int i;
srand(time(NULL));
for (i = 0; i < 16; i++) {
code[i] = alphanumeric((rand() % 62));
}
return code;
}
At the return line the code breaks.