This code doesn't work and I don't know why, I used everything exactly as my professor told us and I think it should work, why does compiler throw Segmentation fault(core dumped) exception. What am I doing wrong?
int main() {
    int n;
    char *chr;
    char pchr;
    scanf("%s", chr);
    scanf(" %d", &n);
    char **table = (char **) malloc(n * sizeof(char*));
    char *chr2 = chr;
}
this is only part of my program but when I run only this code compiler throws an exception. It doesn't even scan an n number it only scans char and then throws an exception. Thank you for answers.
 
    