How can I allocate arrays or structures bigger than 64K?

Answers were Sorted based on User's Feedback



How can I allocate arrays or structures bigger than 64K?..

Answer / s.v.prasad reddy,lifetree

Generally using the malloc() function maximum we can
allocate the 64K memory.

If you want to allocate the memory larger than 64K then you
have to use the farmalloc() memory management function.

And one more important thing is ,Once memory is allocated
by the farmalloc(),then to free that memory we need to use
only farfree() fuction.We can't use the free() fuction to
free that memory.

Is This Answer Correct ?    15 Yes 2 No

How can I allocate arrays or structures bigger than 64K?..

Answer / sathish kumar

HI All,

In a book i studied that you can use far* to allocate
memory above 64k limit.

Thanks & Regards
Sathish Kumar

Is This Answer Correct ?    6 Yes 4 No

How can I allocate arrays or structures bigger than 64K?..

Answer / phani kumar s

by using the pointers with the structures we can allocate the
memory for the structure ,Pointers are DMA

Is This Answer Correct ?    3 Yes 2 No

How can I allocate arrays or structures bigger than 64K?..

Answer / dinakarangct

#include<stdio.h>
struct stud {
int i,j,k;
struct stud *next,*prev;
}**ptr;
void main(){
int i;
ptr= ( struct stud **)malloc(sizeof(struct stud*)*6400 );
for(i=0;i<6400;i++)
ptr[i]= ( struct stud *)malloc(sizeof(struct stud)*10 );
}

Is This Answer Correct ?    5 Yes 4 No

How can I allocate arrays or structures bigger than 64K?..

Answer / nithya

For arrays larger than 64k use

char huge array3[100000L];

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

Please write me a program to print the first 50 prime numbers (NOT between the range 1 -50)

5 Answers   IBM, KJH,


An array name contains base address of the array. Can we change the base address of the array?

4 Answers   NMIMS, Wipro,


Hi can anyone tell what is a start up code?

0 Answers   CTS,


how can i print "hello"

3 Answers  


what is a static function

10 Answers   Satyam,






what would be the output of the follwing struct st { char name[20]; int i; float f; }; main() { struct st emp = {"forum"}; printf("%d %f",emp.i,emp.f); }

4 Answers  


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

0 Answers   Reliance,


Eight queens puzzle

0 Answers  


what are far pointers?

1 Answers  


write a program to display all prime numbers

0 Answers  


What are the types of arrays in c?

0 Answers  


Can the curly brackets { } be used to enclose a single line of code?

0 Answers  


Categories