I have another noob question about matrices, again.

Say I have a matrix A and a vector b. I want to create a function that will give me a new matrix C = A*A and also in the same function, calculate another vector D = A*b. If I call the function from main, how do I go about getting the function to return either C or D, or both C and D? Is this possible? Before, I used if/else for different equations in a function but this is matrices, so I'm confused on how to specify it. Any help is appreciated, thanks!