So I am writing a program that will encrypt a 2D array of chars in a function by passing a 2d array to it, but I am struggling to return it to main so I can use it other functions such as encrypt again to encrypt it twice.
char *encrypt(char bob[6][6], int key[6])[6][6]
{
int i ,j;
char tempArr[6][6];
printf("\n");
for (i = 0; i < 6; i++) {
for (j = 0; j < 6; j++)
{
int col = key[j];
printf("%c", bob[i][col]);
tempArr[i][j] = bob[i][col];
}
printf("\n");
}
for (i = 0; i < 6; i++) {
for (j = 0; j < 6; j++)
{
printf("%c", tempArr[j][i]);
}
printf(" ");
}
return tempArr;
}
this is my encrypt function that I am trying to return a string/2d array from **tempArr = encrypt(bob, key); encrypt(tempArr, key); and this is how I am passing the data through to that function