arrays in functions
<p>i am trying to write a program which inputs two numbers from user as strings....if the first number is greater than the second number they are multiplied and the result is returned...i converted the input numbers into character arrays and then used ascii codes to convert the charcters into actual numbers...then i performed calculations on the numbers...here are the functions that i used...</p>

<pre><code>double greater1(char a[],char b[],int size1,int size2)//the arrays here are those containing the two numbers
{ double first;
double second;
 for(int i=0;i&lt;size1;i++)
 first=first+(pow(10.0,(double)(size1-i-1))*(a[i]-48));
 for(int i=0;i&lt;size2;i++)
 second=second+(pow(10.0,(double)(size2-i-1))*(b[i]-48));
 return(first&gt;second?first:second);
}   

double smaller1(char a[],char b[],int size1,int size2)
{ double first;
double second;
 for(int i=0;i&lt;size1;i++)
 first=first+(pow(10.0,(double)(size1-i-1))*(a[i]-48));
 for(int i=0;i&lt;size2;i++)
 second=second+(pow(10.0,(double)(size2-i-1))*(b[i]-48));
 return(first&lt;second?first:second);
}     

double multiply(char a[], char b[],int size1,int size2) 
{double first=greater1(a,b,size1,size2);
double second=smaller1(a,b,size1,size2);
//cout&lt;&lt;second;....(a)
//cout&lt;&lt;smaller1(a,b,size1,size2);....(b)
//cout&lt;&lt;smaller1(a,b,size1,size2);....(c)
//cout&lt;&lt;smaller1(a,b,size1,size2);....(d)
double mult=first*second;
return mult;
} 
</code></pre>

<p>now to test these functions i input 43 and 10...but the product which was returned was 860...so to find the error i inserted the lines (a),(b),(c),(d)....(a) gave output 20,(b) gave 30 and after that all further lines (c),(d)... were giving output as 10...when i inserted </p>

<pre><code>cout&lt;&lt;smaller1(arr1,arr2,ln1,ln2);//these parameters were the ones also passed to the above three functions             
</code></pre>

<p>in main(), everytime i got the output 10....so there must be some problem with using smaller1() in multiply func...plz can anyone point out the problem</p>
