#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
int main()
{
const char mot1[] = "POMME", mot2[] = "POIRE", mot4[] = "PASTEQUE", mot5[] = "MELON", mot6[] = "ORANGE", mot7[] = "FRAISE", mot8[] = "FRAMBOISE", mot9[] = "CITRON", mot10[] = "MANGUE";
srand(time(NULL));
int index = rand() % 10 + 1;
char secret[100] = "";
strcpy(motindex, secret);
printf("Secret is now %s\n", secret);
return 0;
}
Here's the code I made to generate a random secret word from a range of const char.
I want to substitute index
in strcpy(motindex, secret);
. How can I do that ?