Problem with C pointers

0

My problem is this: I have the following code

char v = 65;
char k = 65;
char* un = calloc(2, sizeof(char));

for (int i = 0; (25*i < dot) && (i <= 25); i++){
    un[0] = v;
    for (j = 0; (j <= 25) && ((j + (25*i)) < dot); j++){
        un[1] = k;
        strcpy(var[i][j], un);
        printf("%d %d var[0][6] = %s\n", i,j,var[0][6]);

        if((j + 25*i + 1) < dot){
            fprintf(f, " + ");
        }

        k++;
    }

    if((j + 25*i + 1) >= dot){
        fprintf(f, ", t) :-");
        break;
    }
    v++;
    k = 65;
}

What happens is that the cells of

  

var [0] [6]   it is changed to the value of   var [1] [0]

and so on. What I want is that this does not happen. Thanks.

    
asked by Brais Castiñeiras Galdo 12.04.2018 в 20:01
source

0 answers