C/arrays

Advertisement


Question
QUESTION:   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

Answer
Hi 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

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Joydeep Bhattacharya

Expertise

Ability to solve C and Data Structure problems and puzzles with simple and easy to understand logic.

Experience

C, C++, Java, Data Structure, PHP, Web Designing

Organizations
http://www.scodz.com Designation: webmaster

Publications
http://www.scodz.com

Education/Credentials
Master of Computer Applications

Past/Present Clients
http://analysingc.50webs.com http://www.funforu.com

©2012 About.com, a part of The New York Times Company. All rights reserved.