Watch your types.
Going off of dubydapreek's revision:Lines 7..11: Useless. Get rid of them. (You don't need to copy b to a before you copy b to a.)
Lines 27..28: You should be allocating an array of (double *).
Lines 31..32: You should be allocating an array of (double).
As a rule, when using malloc(), it should look something like:
<strong>type</strong> *foo = (<strong>type</strong> *)malloc( n *sizeof( <strong>type</strong> ) );
where "type" is whatever type you need it to be. In your case, "type" is first (double*) then it is (double).
Hope this helps.
Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229