[ back to toc ]

C arrays

Date: 2002/02/15 09:16

Q:
hi ,i have a problem with arrays!!so i cant deal with this program,,plz
help,,
the question is::
the c programming language is able to add two integers directly,however
there is a certain limit for the capacity of integers,integers above this
capacity still can be represented in c using arrays:
int a[30},b{30},c{30};
int n,m,k;//the actual size of a,b,c respectively.
the data in each cell of this array should be restricted to values from 0
to 9
write a program to add 2 such integers the program should contain 3
functions:
* int READINTEGER(int Z[])that will be called twice to read 2 integers.
*int add (int A[],int n,int B[],int m,int C[])to add two integers ,it will
compute C and return the number of digits in the result ,if this number is
31 then an overflow has occurred and the contents of c should not be
considered .
*void print(int Z[],int n) that will be called thrice to display the 2
integers and their sum ,if an overflow has occurred then give a suitable
error message.
thats all!
i cant do it !!!plz plz plz help,,,regards ajwan
A:
http://peter.verhas.com/cript/aritme.htm

the explanation is Hungarian, but you should be able to understand the
code.

You can also download from somewhere the GNU APM that means arbitrary
precision mathematics library. That is more general and maybe less
suitable to learn as that is bigger.

Regards,
Peter

[ back to toc ]