I am sorry but I couldnt find the solving

  • Thread starter emre esirik(hacettepe computer science and enginee
  • Start date
E

emre esirik(hacettepe computer science and enginee

/////////////////////// DIVISION FUNCTION ////////////////////
void div ( int pol1[] , int pol1p[] , int pol2[] , int pol2p[])
{
int r=0,z,i,g,j,k,l,dividend[6],rising[6]={0};
for (i=0 ; i<6 ; i++)
dividend=pol1;
for(i=5 ; i >=0 ; i--)
{
if(dividend!=0)
{
for(z=5 ; z>=0 ; z--)
{

if(pol2[z]!=0)
{
*(po5 + (i-z))= dividend/pol2[z];
r++;
for(l=0; l<6; l++)
rising[l]=0;
for (j=z ; j>=0 ; j--) {
rising[i+j-z] += (*(po5 + i-z) * pol2[j]);
}
for(k=0; k<6 ; k++) {
dividend[k] = dividend[k] - rising[k];
}
}
}
}
}

this is my code, its for 2 poly which max power is 5 and I have to
divide them but it sometimes divide right,sometimes divide wrong,
can you see the problem?
 
R

Richard Heathfield

emre esirik(hacettepe computer science and engineering) said:
/////////////////////// DIVISION FUNCTION ////////////////////
void div

You have already been told at least twice that your function's name clashes
with the name of a function in the standard library. Since you haven't
shown any sign of understanding and heeding that advice, you'll find it
hard to persuade anyone that it's worth trying to help you with advice
that may turn out to be even more complicated.
 
U

user923005

/////////////////////// DIVISION FUNCTION ////////////////////
void div ( int pol1[] , int pol1p[] , int pol2[] , int pol2p[])
{
int r=0,z,i,g,j,k,l,dividend[6],rising[6]={0};
for (i=0 ; i<6 ; i++)
dividend=pol1;
for(i=5 ; i >=0 ; i--)
{
if(dividend!=0)
{
for(z=5 ; z>=0 ; z--)
{

if(pol2[z]!=0)
{
*(po5 + (i-z))= dividend/pol2[z];
r++;
for(l=0; l<6; l++)
rising[l]=0;
for (j=z ; j>=0 ; j--) {
rising[i+j-z] += (*(po5 + i-z) * pol2[j]);
}
for(k=0; k<6 ; k++) {
dividend[k] = dividend[k] - rising[k];
}
}
}
}
}

this is my code, its for 2 poly which max power is 5 and I have to
divide them but it sometimes divide right,sometimes divide wrong,
can you see the problem?


C:\tmp>splint div.c
Splint 3.1.1 --- 12 Mar 2007

div.c(1,17): Function div inconsistently declared to return void
A function, variable or constant is redefined with a different type.
(Use
-incondefs to inhibit warning)
load file standard.lcd: Specification of div: div_t
div.c(1,17): Function div declared with 4 args, specified with 2
Types are incompatible. (Use -type to inhibit warning)
load file standard.lcd: Specification of div
div.c(1,25): Parameter 1, pol1, of function div has inconsistent type:
declared int [], specified int
load file standard.lcd: Specification of pol1: int
div.c(1,37): Parameter 2, pol1p, of function div has inconsistent
type:
declared int [], specified int
load file standard.lcd: Specification of pol1p: int
div.c: (in function div)
div.c(12,5): Initializer block for rising has 1 element, but declared
as int
[6]: 0
Initializer does not define all elements of a declared array. (Use
-initallelements to inhibit warning)
div.c(20,23): Unrecognized identifier: po5
Identifier used in code has not been declared. (Use -unrecog to
inhibit
warning)
div.c(6,21): Variable g declared but not used
A variable is declared but never used. Use /*@unused@*/ in front of
declaration to suppress message. (Use -varuse to inhibit warning)
div.c(1,37): Parameter pol1p not used
A function parameter is not used in the body of the function. If the
argument
is needed for type compatibility or future plans, use /*@unused@*/
in the
argument declaration. (Use -paramuse to inhibit warning)
div.c(1,62): Parameter pol2p not used

Finished checking --- 9 code warnings
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top