Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void main(){
- int row,col;
- printf("Matrix Execrise\n");
- printf("###############\n");
- printf("Enter Cols Size: ");
- scanf("%d",&col);
- printf("Enter Rows Size:");
- scanf("%d",&row);
- printf("Build Matrix...\n");
- int **mat = (int **)malloc(sizeof(int*)*row);
- int i,j;
- for(i=0;i<row;i++){
- mat[i]=(int *)malloc(sizeof(int)*col);
- }
- printf("Reset Matrix...\n");
- for(i=0;i<row;i++){
- for(j=0;j<col;j++){
- mat[i][j]=0;
- }
- }
- printf("Print Matrix...\n");
- for(i=0;i<row;i++){
- for(j=0;j<col;j++){
- printf(" %d",mat[i][j]);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement