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
formula to convert 2500mmh2o into m3/hr
#include
What is the use of putchar function?
difference between native and cross compilers
main() { printf("hello"); fork(); }
Write a program to check prime number in c programming?
What is pass by value in c?
Is main is user defined function?
Describe the order of precedence with regards to operators in C.
State two uses of pointers in C?
How many levels of indirection in pointers can you have in a single declaration?
What is boolean in c?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
Calculate 1*2*3*____*n using recursive function??
what does static variable mean?