If you know the size of both matrices and those sizes will not change then it is much easier to just do:

Code:

void MatMult4x4(float mat1[4][4],float mat2[4][4],float result[4][4])
{
for (int i=0;i<4;i++)
{
for (int j=0;j<4;j++)
{
result[i][j]=0.0f;
for (int k=0;k<4;k++)
{
result[i][j]+=mat1[i][k]*mat2[k][j];
}
}
}
}

If you have variable sized matrices and are not against using C++ then I would recommend creating a matrix class that can handle all types and sizes of matrices. You could then write generic C functions that know how to concatenate as well as IF two matrices can be concatenated.

This is the approach I used in the past before the D3DX library was widely used and available.

My matrix class would control all aspects of a matrix and I had a generic matrix library that could multiply different sized matrices together provided the sizes were provided by the caller.

There are cases in which two matrices cannot be concatenated and your code should check for this. It is not the easiest task to create an all-inclusive matrix library that can handle any size matrix. My use of matrices has always been directly linked to doing 3D graphics and as such I rarely concatenate any matrix over 4x4 or under 3x3.

In order to code a function to multiply a vector by a matrix you also must satsify certain conditions. If you know how many components a vector has and the size of the matrix then the code is easy. Coding a universal function to multiply matrices and vectors regardless of size is also not the easiest task.

This is how you multiply a 3D vector by a 4x4 matrix.

Code:

struct Vector3
{
float x,y,z;
};
void VectorMul4x4(const Vector3 in,const float Mat[4][4],Vector3 &out)
{
out.x=in.x*mat[0][0]+in.y*mat[0][1]+in.z*mat[0][2]+mat[0][3];
out.y=in.x*mat[1][0]+in.y*mat[1][1]+in.z*mat[1][2]+mat[1][3];
out.z=in.x*mat[2][0]+in.y*mat[2][1]+in.z*mat[2][2]+mat[2][3];
}

Note that this code only works for right handed coordinate systems.

I would not create a function that did everything you wanted in one swoop. It is much easier to create several generic functions that will concatenate matrices and that will multiply vectors by matrices or more appropriately transform a vector by a matrix. If you have the Direct3D SDK you can look in the help file and it will show you how to transform matrices and vectors and the math behind it. There is also tons of information on the net about this topic. I recommend www.gamedev.net which has several articles on this topic as well as a lot of source code. Another is www.gamasutra.com which also has tons of information on this very topic. Since 3D graphics are so popular and since matrices and 3D graphics are like bread and butter, it's very easy now to find tons of resources about operations on vectors and matrices. I recommend you read up on vectors and matrices and the different operations for both before coding anything.