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 / anshu ranjan
I want to make a point here...I am not sure whether there is a limit to amount of memory that you can allocate using malloc...
I used this code in a program and it ran perfectly fine...
--------------
char **a;
int **val;
a =(char **) malloc ( 1000 * sizeof *a );
for ( i = 0; i < 1000; i++ )
a[i] =(char *) malloc ( 1000 * sizeof *a[i] );
val =(int **) malloc ( 1000 * sizeof *val );
for ( i = 0; i < 1000; i++ )
val[i] =(int *) malloc ( 1000 * sizeof *val[i] );
---------------
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Are the variables argc and argv are always local to main?
When is a null pointer used?
How do I determine whether a character is numeric, alphabetic, and so on?
Why clrscr is used in c?
What is the difference between int main and void main?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
Differentiate between full, complete & perfect binary trees.
What is the process to create increment and decrement stamen in c?
What is the difference between union and anonymous union?
How many levels of pointers have?
What is clrscr ()?
Can you define which header file to include at compile time?
write an algorithm to display a square matrix.
Dont ansi function prototypes render lint obsolete?
Can we compile a program without main() function?