C/arrays
Expert: Joydeep Bhattacharya - 6/24/2007
QuestionQUESTION: Hi,
How are you?
I have a C question. I declare an array
int myarray[300];
I want to store large values in my array (1,500,000) but this array cannot hold the values. How do you declare array for long integers? I'm usind Turbo C, so I can't do some of the fancy stuff. Turbo C is an old compiler.
Thanks a lot.
Tom
ANSWER: Hi Tom
I am fine, How are you ?
when you want to use large numbers don't go for integer array try with long int.
You can create an array of long int like this
long int x[300];
Long int can store more than 999999999 I have used this once in my program you can have a look at it also in this link:
http://www.scodz.com/ViewProgram.php?link=126&uid=2
And this is a Turbo C compatible program to convert a number from digit to word.
I hope that this would clear your doubt, but still in case if you find it difficult to do it please feel free to revert back to me.
regards
Joydeep Bhattacharya
http://www.scodz.com
---------- FOLLOW-UP ----------
QUESTION: Hi,
Thanks a lot for your answer.
Unfortunately declaring my array long int myarray[300]; still won't allow me to store anything bigger than about 30000 in this array. There is something I'm missing. Maybe I don't include a certain *.h file? What *.h file do I need to include for the Turbo C to allow larger intries in my array? Do you have any other ideas as to what I could try.
Most thanfully,
Tom
AnswerHi Tom
There is no special header file needed I think there is some problem with your TC you can download TC from rapidshare I have uploaded it for you
Here is the link
http://rapidshare.com/files/4998778/TC.rar
And if you are still having problem then please send me the code or the part of the code that is giving trouble at my email id at joydeep1982@gmail.com so that i can check it out and send back to you.
regards
Joydeep Bhattacharya
http://www.scodz.com