Changing dimensions on 2-D array

I have compiled a 2-D array code, but I don’t know how to change the dimensions independently of each other. Thanks in advance to anyone who knows.

include <stdio.h>

include <stdlib.h>

include <assert.h>

include <cuda.h>

global void FILENAME(float VAR_device, float AND_device, size_t pitch_A, size_t pitch_B)
{
int idx = blockIdx.x
blockDim.x + threadIdx.x;
int idy = blockIdx.y
blockDim.y+ threadIdx.y;
((float )((char )ANS_device + idypitch_B) + idx) = 0.25((float )((char )VAR_device + (idy - 1)pitch_A) + idx) + 0.5((float )((char )VAR_device + idypitch_A) + idx) + 0.25((float *)((char *)VAR_device + (idy + 1)*pitch_A) + idx);
}

int main()
{
int N = 6;
float *ANS_device, VAR_device;
size_t size = N
sizeof(float);

float VAR_host[N][N], ANS_host[N][N];

size_t pitch_A, pitch_B;
cudaMallocPitch((void **)(&ANS_device), &pitch_A, size, N);
cudaMallocPitch((void **)(&VAR_device), &pitch_B, size, N);

for(int i=0; i<1; i++)
{
for(int j=0; j<N; j++)
{
VAR_host[i][j] = 1;
}
}
for(int i=1; i<N; i++)
{
for(int j=0; j<N; j++)
{
VAR_host[i][j] = 0;
}
}

cudaMemcpy2S(ANS_device, pitch_A, VAR_hose, size, size, N, cudaMemcpyHostToDevice);

dim3 dimBlock(N/2, N/2);
dim3 nBlocks(2, 2);

float nIterations = 7;
for(int k=0; k<nIterations; k++)
{
FILENAME <<< nBlocks, dimBlock >>> (ANS_device, VAR_device, pitch_A, pitch_B);
float *temp = ANS_device;
ANS_device = VAR_device;
VAR_device = temp;
}

cudaMemcpy2D(ANS_host, size, VAR_device, pitch_B, size, N, cudaMemcpyDeviceToHost);

for(int j=0; j<N; j++)
{
for(int i=0; i<N; i++)
{
printf("%f “, ANS_host[i][j]);
}
printf(”\n");
}

cudaFree(VAR_device);
cudaFree(ANS_device);
return 0;
}