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
Write a factorial program using C.
What is the advantage of a random access file?
How can I read/write structures from/to data files?
What is the significance of scope resolution operator?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
Explain what is a program flowchart and explain how does it help in writing a program?
What is new line escape sequence?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
What is uint8 in c?
Explain about C function prototype?
Can we change the value of #define in c?
Is c compiled or interpreted?
What are the 5 types of inheritance in c ++?
Is it cc or c in a letter?
What are high level languages like C and FORTRAN also known as?