'In for loop, I want to get array every time

#include<stdio.h>
#include<time.h>

int main(void)
{
srand(time(NULL));
int answer;
int treatment = rand() % 4;
printf("###발모제 찾기###\n\n");

int cntShowBottle = 0;
int prevCntShowBottle = 0;

for (int i = 1; i <=3; i++)
{
    int bottle[4] = { 0, 0, 0, 0 };
    int* ptr = bottle;
    do {
        cntShowBottle = rand() % 2 + 2;
    } while (cntShowBottle == prevCntShowBottle);
    prevCntShowBottle == cntShowBottle;

    int isincluded = 0;
    printf(" %d 번째 시도 : ", i);

        for (int j = 0; j < cntShowBottle; j++)
        {
            int randBottle = rand() % 4;

            if (bottle[randBottle] == 0)
            {
                bottle[randBottle] = 1;
                if (randBottle == treatment)
                {
                    isincluded = 1;
                }
            }
            else
            {
                j--;
            }
        }

I want to get different array 'bottle[]' every time like {0,1,1,0},{1,1,1,0},{1,1,0,1} without duplication.. I think it needs (do while) and (pointer), but I don't know how to coding.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source