My Profile

Ahmednagar, Maharashtra, India
I, Das ShrikKrishna J. MCA III IMSCD&R, Ahmednagar.

Saturday, 23 July 2011

Use of Malloc(DS using C)

#include<stdio.h>
#include<conio.h>
typedef struct
{
int row,col,val;
}smat;
void main()
{
smat a[10];
int i,j,k;
printf("Enter the total no of rows & total no of column");
scanf("%d%d",&a[0].row,&a[0].col);
printf("Enter the total no nof non zero element");
scanf("%d",&a[0].val);
for(i=1;i<=a[0].row;i++)
{
printf("Enter the row no& col no& value");
scanf("%d%d%d",&a[i].row,a[i].col,a[i].val);
}
printf("sparse matrix");
for(i=0;i<=a[0].val;++i)
printf("%d%d%d\n",a[i].row,a[i].col,a[i].val);
getch();
}

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | cheap international calls