alloca() allocates memory from
Practice Memory Allocation – alloca() allocates memory from
Practice Memory Allocation – alloca() allocates memory from
FUNC

Practice Memory Allocation – Output of the code?
FUNC (int *p)
{
p = (int *)malloc(100);
printf("p:%x",p);
}
int main( )
{
int *ptr;
FUNC(ptr);
printf("Ptr:%x",ptr);
return 0;
}

Practice Memory Allocation – What will be result of the following program?
#include
#include
int myalloc(char *x, int n){
x= (char *)malloc(n*sizeof(char));
memset(x,,n*sizeof(char));
}
int main(){
char *g="String";
myalloc(g,20);
printf("The string is %s",g);
return 0;
}

Practice Memory Allocation – What will the following program do?
#include
#include
#include
int main(){
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p); //Line no:9//
p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
return 0;
}
Chose correct option
x = malloc (y).
Which of the following statements is corr

Practice Memory Allocation – x = malloc (y).
Which of the following statements is correct.
What will be output of the following “C” code?

Practice Memory Allocation – What will be output of the following “C” code?
FUNC (int *p)
{
p = (int *)malloc(100);
printf("p:%x",p);
}
int main( )
{
int *ptr;
FUNC(ptr);
printf("Ptr:%x",ptr);
return 0;
}

Practice Memory Allocation – What should the program below print?
void myfunc(char** param){
++param;
}
int main(){
char* string = (char*)malloc(64);
strcpy(string, "hello_World");
myfunc(&string);
myfunc(&string);
printf("%s
", string);
return 0;
}
What will be the output of the program on GCC compiler?

Practice Memory Allocation –
What will be the output of the program on GCC compiler?
#include<stdio.h>
#include<stdlib.h>
int main() {
int *p;
p = (int *)malloc(20);
printf("%d
", sizeof(p));
free(p);
return 0;
}
What will be the output of the following code on GCC compiler (64 b

Practice Memory Allocation –
What will be the output of the following code on GCC compiler (64 bit machine)?
#include<stdio.h>
#include<stdlib.h>
#define MAXROW 3
#define MAXCOL 4
int main() {
int (*p)[MAXCOL];
p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p));
printf("%d, %d
", sizeof(p), sizeof(*p));
return 0;
}
What will be the output of the program on GCC compiler?

Practice Memory Allocation –
What will be the output of the program on GCC compiler?
#include<stdio.h>
#include<stdlib.h>
int main() {
int *p;
p = (int *)malloc(20);
printf("%d
", sizeof(p));
free(p);
return 0;
}
How many bytes will be allocated for the following code on GCC comp

Practice Memory Allocation –
How many bytes will be allocated for the following code on GCC compiler(64 bit machine)?
#include<stdio.h>
#include<stdlib.h>
#define MAXROW 3
#define MAXCOL 4
int main() {
int (*p)[MAXCOL];
p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p));
return 0;
}
Which of the following statements is correct?

Practice Memory Allocation –
Which of the following statements is correct?
Specify the 2 library functions to dynamically allocate memory?

Practice Memory Allocation –
Specify the 2 library functions to dynamically allocate memory?