# how to concatenate a matrix?

 Alex Nuta · August 26, 2014 Hello, I'm new here and I am also relatively new to c. I have to concatenate a matrix and I don't know how to do that, have searched a little on google but it raises more questions than answes.For example if i have a matrix  [3][3]  and I want do add 0 around the matrix, how do I do that?   the final form should be like:0 0 0 0 00 1 1 1 00 1 1 1 00 1 1 1 00 0 0 0 0 #include int main(){int mat [3][3];int i,j;  for (i=0;i< 3; i++){    for(j=0;j< 3; j++){      scanf("%d", &mat[j]);  }    }................... and now i want to add around mat 0's      ty in advance.return 0;}

## Replies

 Bucky Roberts · August 26, 2014 This doesn't use a matrix, but it does show you how you can break it up to accomplish what you want to to. It will work for any size matrix.``#include int main(){    int a, i, j;    //the column and row length of the original matrix    int col = 5;    int row = 9;    // print the first row of o's    for(a=-1; a<=col; a++){        printf("o ");    }    printf("\n");    //create the matrix with o's on left and right    for(i=0; imaxtime){maxtime=counter;}}}}printf("%d",maxtime);
• 1

## C

126,708 followers