0

Random number in array index doesnt work and its always 1st element chosen:

int random()// Randomizer
{
    srand(time(0));
    ranq = rand() % 2;
}
int i = 0;
...
...
const char** tabP[3] = { &p1[ranq], &p2[ranq], &p3[ranq]};
do
{
random();
printf(*tabP[i]);
...
++i;
}while(i!=11)

And the problem is, the output of printf is always p1[0], although ranq value varies between 0 and 3.

xantico
  • 3
  • 2

0 Answers0