title: Returning Structures in C++ from functions
body: <p>I am trying to return a struct from a function and am having issues with the data types. I keep getting the complier error "No Suitable conversion function from "coefficients" to "int" exists "return coeff;"" from the code below. I have seen lots of people having these issues because they are defining the structure in the function, but mine is defined at the start. Any feedback would be great.</p>
  
  <pre><code>#include &lt;iostream&gt; //initialise the code familly used in most commands
  using namespace std; //initialise the coding name space
  
  struct coefficients {
      float A;
      float B;
      float C;
  } coeff;
  
  int matrix_multiplication(int r1,int r2,int r3,int r4,int r5) //matrix  multiplication between the readings taken and the regression matrix
  {
  float a1=3.2, b1=-2.8, c1=-0.8, d1=2.2, e1=-0.8; //teach the variables a1-a5   x a1 - d1 the values of the regression matrix
  float a2=-3.0, b2=4.3, c2=0.9, d2=-3.4, e2=1.3;
  float a3=0.9, b3=-1.6, c3=-0.1, d3=2.2, e3=-0.8;
  
  coeff.A = (a1*r1)+(b1*r2)+(c1*r3)+(d1*r4)+(e1*r5);
  coeff.B = (a2*r1)+(b2*r2)+(c2*r3)+(d2*r4)+(e2*r5);
  coeff.C = (a3*r1)+(b3*r2)+(c3*r3)+(d3*r4)+(e3*r5);
  return coeff;
  }
  </code></pre>