For instance, shouldn't the following code work if I wanted to pass an element of a 2d array? if not what would be the best way to do it? Thank you!

#include <iostream>
using namespace std;

void randomProgram(char random[][]){
    random code inside of here;
    }

int main(){
    char letters[6][6] = {random variables inside of here};
    randomProgram(letters[][]);
    return 0;
    }

Usually, you will need to also pass the size of the elements, as in:
void randomProgram(char random[][], size_t max1, size_t max2)
where max1 is the size of the first element, and max2 the size of the second. Then you can process it with something like this:

for (size_t i = 0; i < max1; i++)
{
    for (size_t j = 0; j < max2; j++)
    {
        doSomethingWith(random[i][j]);
    }
}

Of course, this is where in C++ we use vectors of vectors. You can much more easily deal with them in code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.