gals and everything in between, first off, I want to say sorry for noob/duplicate question.
TL;DR I want to allocate memory for a 2d array of chars, however I can only do so when the program calls alloc(). Any help is appreciated.
Since you guys love code, here is what I have:
#include <iostream>
using namespace std;
#define LOG(x) cout<<endl<<x<<endl
void alloc(char ***add){
    cout<<"Size: ";int s;cin>>s;
        *add = new char *[s];
        for (int i = 0; i < s; i++) {
            *(add)[i] = new char[s];
            cout<<add[i][i]<<" ; ";
        }
}
int main() {
    char **c;
    alloc(&c);
    for (int i =0;i<2;i++) {
        for (int j = 0; j < 2; j++) {
            cout<<c[i][j];
        }
        cout<<endl;
    }
    
cin.get();
}
Now whenever I run this code, I get the following error: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV).
Also, in the debugger, when the function gets called and I input the size of the array, I get a use of undeclared identifier 'c' error.
Thank you and I apologize again for noob or duplicate question, but I did try the answer I got from Text, alas, to no avail.
 
    