c+
The lab materials explain that we should avoid requesting large amount of memory spaces within a function’s stack frame. What should we do instead if that happens?
Question
Answer As we know that memory or amount of memory depends only oon function .For suppose if we write a short function or the long function so thier within the long function will take more memory and short function for supppose will take short memory
when a Stack frame is constructed during the calling of function when we allocate memory either implicit or explicit it is always requested using a heap in the form of
malloc()
calloc()
realoc()
Example
#include <stdio.h>
int func(int para1, char para2)
{
int local1 = 9;
char local2 = ‘Z’;
return 0;
}
int main(int argc, char *argd[])
{
func(7, ‘8’);
return 0;
}
Get Answers For Free
Most questions answered within 1 hours.