I am working on a school project, trying to create a 2d array based on variables.
int **wagner;
wagner = (int **)calloc((sizeofvstup1 + 1), sizeof(int));
for (int i = 0; i < (sizeofvstup1 + 1); i++) {
    wagner[i] =(int *)calloc((sizeofvstup2 + 1), sizeof(int));
}
I use calloc to get 0 on every array place. But valgrind keeps telling me something like: 
Invalid write of size 8 at the "wagner[i]..."
sizeofvstup1 and sizeofvstup2 are variables of the length of the array.
How am I supposed to use calloc here? Tried many times to change the lines a bit but never helped... :/
What should the code look like to work properly?
 
     
     
    