Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Are the variables argc and argv are always local to main?

1013


When is a null pointer used?

1100


How do I determine whether a character is numeric, alphabetic, and so on?

1119


Why clrscr is used in c?

1003


What is the difference between int main and void main?

1035


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

2124


Differentiate between full, complete & perfect binary trees.

1081


What is the process to create increment and decrement stamen in c?

1045


What is the difference between union and anonymous union?

1292


How many levels of pointers have?

1034


What is clrscr ()?

1101


Can you define which header file to include at compile time?

1010


write an algorithm to display a square matrix.

2690


Dont ansi function prototypes render lint obsolete?

1116


Can we compile a program without main() function?

1112