well, what i want to do is pass 2 arrays to another program so it can do any sort of operation with them using exec(), i tried using a memory allocation but now i dont know how to send it, and then how does another program use what it gets.
--------------------------------------------------
Code:
#include<stdio.h>
#include<stdlib.h>
struct memoria {
int i,j,m,n,h1,h2;
int *mat1;
int *mat2;
};
void* calcular (void* params){
struct memoria * mem = (struct memoria *) params;
}
int main(){
int i,j,m,n,x;
struct memoria pol;
while(1){
printf("introduce el numero de filas y columnas de la matriz 1 y 2 en ese orden \n");
scanf("%d",&i);
scanf("%d",&j);
scanf("%d",&m);
scanf("%d",&n);
if(i!=n || j!=m || i<1 || j<1 || m<1 || n<1)
{
printf("Matrices no multiplicables prueba de nuevo");
}
else{ break; }
}
pol.i = i;
pol.j = j;
pol.m = m;
pol.n = n;
pol.mat1 = malloc( i*j*sizeof(int) );
pol.mat2=malloc(n*m*sizeof(int));
printf("introduce los datos de la matriz 1\n");
for(j=0;j<pol.j;j++){
for(i=0;i<pol.i;i++){
scanf("%d",&x);
pol.mat1[(j*pol.i)+i]=x;
}
}
printf("introduce los datos de la matriz 2\n");
for(m=0;m<pol.m;m++){
for(n=0;n<pol.n;n++){
scanf("%d", &x);
pol.mat2[(m*pol.n)+n]=x;
}
}
for(j=0;j<pol.j;j++){
for(i=0;i<pol.i;i++){
printf("%d ",pol.mat1[(j*pol.i)+i]);
}
printf("\n");
}
for(m=0;m<pol.m;m++){
for(n=0;n<pol.n;n++){
printf("%d ", pol.mat2[(m*pol.n)+n]);
}
printf("\n");
}
return 0;
}