I am writing an semestral work in C but I am unable to recognize the problem here. When I run the code in debug, it gets me a segmentation fault. I am not sure what's wrong. Previously I alocated memory to poleNazvu but instead of segmentation fault it was giving me "trying to free non heap object" so this is not a way. Please tell me how to deal with the segmentation fault. Its happening on the line where I strcpy(poleNazvu... ) I marked it in the code. ALOKACE_POLI = 200 ; ALOKACE_MALA=20; What it does is that it takes a "john 500" and levaStrana gets "john" while pravaStrana gets "500" So I am trying to copy the levaStrana to poleNazvu and pravaStrana to poleKreditu. At the end of this code snip is the segmentation fault.
void menuHighlights(void)                                               //menu se zebricky uzivatelu
{
    char vyber3, * poleNazvu[ALOKACE_POLI][ALOKACE_MALA],line[ALOKACE_LINE];
    char * prohodJmeno, * menic, * separator, * levaStrana, * pravaStrana;
    int poleKreditu[ALOKACE_POLI], count=0, countMax=0, prohodCislo, d;
    FILE *NACTENI;
    //int alokace1=0, alokace2=0;                                                       //vytvoreni promenne pro soubor
    fflush(stdin);                                                      //vyprazdneni bufferu
    system("cls");                                                      // vycisteni obrazovky
    printf("\nZebricek nejlepsich hracu:\n");                                               //tisk hlavicky
    fflush(stdin);                                                      //buffer
    NACTENI = fopen(SOUBOR_HRACU , "r");                                    //ulozeni otevreneho souboru do promenne
    if(NACTENI == NULL) {                                            //jestlize v promenne nic neni
        perror("Soubor nenalezen.");                                    //vypis error
        Sleep(HODNOTA_BIG_SLEEP);                                                   //nech uzivatel aby si to precetl
        exit(1);    //a pak ukonci seanci
    }
    while (fgets(line, sizeof line, NACTENI) != NULL) {                 //pokud radek nacteny ze souboru nebude prazdny
        fflush(stdin);                                                  //buffer
        menic=line;                                                     //anti-decay opatreni promenne line
        separator = " ";
        levaStrana = strtok(menic, separator);
        pravaStrana = strtok(NULL, "");
        //if ((poleNazvu[count][ALOKACE_MALA-1]=(char *)malloc(ALOKACE_PROHAZOVANI*sizeof(char)))==NULL) {
        //    printf("Nedostatek pameti. Ukoncuji.");
        //    exit(1);
        //}
        //alokace1=1;
        strcpy(poleNazvu[count][ALOKACE_MALA-1],levaStrana); //ITS HERE
        poleKreditu[count]=atoi(pravaStrana);
        if (countMax<count) {
            countMax=count;
        }
        count++;
    }
 
    