I am rewriting MatLab code in C and I need some direction on how to approach converting the code.

Basically, a user inputs one of 6 scenarios. Each scenario has about 6 matrices with stored values. The problem is that each scenario uses different sized matrices. A has 1x2 and 1x1, where B has 2x8 and so forth...

I originally wanted to use pointers, because for dynamic arrays, I was taught that pointers work better. However, if I declare pointers, how do I store the values into the pointer without having to retype
Code:
p[x][y] = number
for each element? As far as I know, if I declare a double pointer to a 2D matrix, I can't just say
Code:
p[2][2] = {{a,b},{c,d}};
So how do I do this without having to create multiple functions? I can't just declare new variables in my switch statement, because they won't work in the rest of the program, right?