in this code i did matrix multiplication
1. it accepts size of the matrix 1 .
2 . i used functions for enter matrix from user and print it.
problem is that....it is printing garbage elements...
#include<stdio.h>
#include<conio.h>
void mx_enter(long int **arg,long int a,long int b)
{
long int i,j;
arg=(int **)malloc(a* b* sizeof(int));
for(i=0;i<a;i++)
{
for(j=0;j<b;j++)
{
scanf("\n%ld",&arg[i][j]);
}
}
}
void mx_prn(long int **arg,long int a,long int b)
{
long int i,j;
for(i=0;i<a;i++)
{
for(j=0;j<b;j++)
{
printf("\t%ld",arg[i][j]);
}
printf("\n");
}
}
void main()
{
long int **mat1;
long int row1,col1;
clrscr();
printf("\nEnter the size of matrix 1: ");
scanf("%ld%ld",&row1,&col1);
printf("\n you entered %ld * %ld matrix\n",row1,col1);
printf("\nenter elements of matrix 1: \n");
mx_enter(mat1,row1,col1);
mx_prn(mat1,row1,col1);
getch();
}