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

#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }

0 Answers   Wilco,


Is c still used?

0 Answers  


Explain how can I avoid the abort, retry, fail messages?

0 Answers  


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

0 Answers   Aspiring Minds,


write a function to find whether a string is palindrome or not and how many palindrome this string contain?

2 Answers   Aptech,






When should we use pointers in a c program?

0 Answers  


define function

4 Answers   Assurgent, Sonata,


how to construct a simulator keeping the logical boolean gates in c

0 Answers  


Difference between linking and loading?

0 Answers  


What is the difference between text and binary modes?

0 Answers  


Write a C++ program to give the number of days in each month according to what the user entered. example: the user enters June the program must count number of days from January up to June

0 Answers  


What is the use of f in c?

0 Answers  


Categories