I use turbo C which allocates 2 bytes for integers and 4
bytes for long. I tried to declare array of size 500000 of
long type using the following code...

long *arr;
arr=(long *)(malloc)(500000 * sizeof(long));

It gives a warning that "Conversion may lose significant
digits in function main"...

And the resulting array size was very less around 8400 as
compared to 500000. Any suggestions will be welcomed....

Answer Posted / vignesh1988i

good morning to you.....


here what i suggest is that , at the time of dynamic memory allocation the memory would not been in the position to allocate that much of huge memory at a single instance...... UR MEMORY WILL BE INCAPABLE IF U TRY TO ALLOCATE A HUGE AMOUNT LIKE ABOVE FOR UR USE.......

u try this.... you declare an array size of 200 or 300... this will give a warning that MEMORY FULL........ the one of the disadvantages in C is that we cant balance a very large amount of data's which are outside the range .... so only we will go for DATA BASE.......



hope this helps u for getting some ideas.......

thank u

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is main is user defined function?

599


What are formal parameters?

664


while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above

747


What is volatile, register definition in C

693


What is variable initialization and why is it important?

623






How do I use strcmp?

645


Explain c preprocessor?

686


What are control structures? What are the different types?

600


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2305


Is there any possibility to create customized header file with c programming language?

629


Explain the difference between getch() and getche() in c?

567


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

756


Explain what is output redirection?

670


Can you pass an entire structure to functions?

698


When should structures be passed by values or by references?

588