Hi there! this is my first post, I'm relatively new to C, so I hope to be clear,
so here we go:
I've made a function that works properly, but I fail to pass the resulting array from my function to the main function, here is the code,
I would really appreciate any help,Code:#include <stdio.h> float SV(float dog[12][3]) { int i,j; for(i=0;i<12;i++) { { for(j=0;j<3;j++) printf("dog %8.3f\t", dog[i][j]); } printf("\n"); } return dog[i][j]; //will this work? or should I use some other syntaxis? } int main() { float cat[12][3]={ {-4.859,0.073,0.122}, {-3.610,-0.654,0.017}, {-2.432,0.308,0.088}, {-2.621,1.515,0.217}, {-1.213,-0.231,0.004}, {-0.016,0.584,0.061}, {1.100,-0.061,-0.749}, {1.157,-1.283,-0.869}, {1.989,0.764,-1.306}, {3.095,0.267,-2.100}, {3.942,1.426,-2.607}, {3.646,2.585,-2.327}, }; float mouse[12][3]; int i,j; for(i=0;i<12;i++) for(j=0;j<3;j++) mouse[i][j]=0; mouse[i][j]=SV(cat); //I would like to pass the return array from function SV to mouse variable for(i=0;i<12;i++) { { for(j=0;j<3;j++) printf("mouse %8.3f\t", mouse[i][j]); } printf("\n"); } return 0; }
thank you,
Juan Pablo



LinkBack URL
About LinkBacks



