Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Calculating the sum of two polynomials

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 30-11-2009
Members
 
Join Date: Oct 2009
Posts: 5
Calculating the sum of two polynomials
  

This is an exercise that involves calculating the sum and the product of 2 polynomials. if it has a structure and a pointer within one example:
Code:
typedef struct (
 int a;
 int * a;
 P);
 p p1;
how can we access the pointer? what do you recommend?

Reply With Quote
  #2  
Old 30-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Calculating the sum of two polynomials

declare two variables (pointer or not) with the same name ..
To access:
- The value of the pointer (address): p1.t
- The value of the variable pointed to: p1-> t OR (* p1). T
- The value of the variable p1.a
- The address of the variable & p1.a

So, if t points to a:
p1.t == & p1.a
p1-> t == p1.a
Reply With Quote
  #3  
Old 30-11-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Calculating the sum of two polynomials

A Polynomial in the variable X, of Degree n, has the form: aX^n+bX^(n-1)+...+vX^2+wX+z, where (a),(b),(v),(w),and (z) are Real numbers, (n) is a Whole number, and (a)is not equal to zero, the typedef means you no longer have to write struct all over the place.
Reply With Quote
  #4  
Old 30-11-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Calculating the sum of two polynomials

- The value of the variable pointed to: p1-> t OR (* p1). T
If the pointer is p1.t, the value of the variable is pointing * (p1.t). Writing p1-> * t or (p1). T is legitimate only if p1 is a pointer to a structure of type p, which is not the case.
Code:
p1.t == & p1.a 
p1-> t == p1.a
Same. * (p1.t) == p1.a
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Calculating the sum of two polynomials"
Thread Thread Starter Forum Replies Last Post
Need help calculating Age in FileMaker Pro NathanDS Windows Software 4 29-05-2010 05:16 PM
Calculating Age in java Miles Runner Software Development 5 03-02-2010 01:54 AM
Calculating sum of column in datagrid Chrisch Software Development 3 09-06-2009 10:07 AM
Calculating Matrix Determinant in C Rilex Software Development 3 09-05-2009 08:27 PM
Calculating date in Excel MarceloQuad Windows Software 2 16-03-2009 10:56 PM


All times are GMT +5.5. The time now is 01:26 PM.