This is the code
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
void shuffle(char *array, size_t n)
{
if (n > 1) {
size_t i;
for (i = 0; i < n - 1; i++) {
size_t j = i + rand() / (RAND_MAX / (n - i) + 1);
char *t = array[j];
array[j] = array[i];
array[i] = t;
}
}
}
int main()
{
char a[5][20] = {
"singular","wanttome","experience","levelup","babyboy"
};
char *word = (char*) malloc(6);
int i,rndm,cndtn=0;
char *comp= (char*) malloc(6);
char z[100],msg[1000];
srand((unsigned)time(NULL));
rndm = rand()%5;
for (i = 0; i < strlen(a[0]); i++)
z[i] = a[rndm][i];
printf("%d\n",strlen(z));
shuffle(z,strlen(z));
printf("Clues :");
// for (i = 0; i < strlen(z); i++)
printf("%s",z);
printf("\n");
return 0;
}
i want to make the word shuffle....