What will happens if the statement free(a) is removed in the following C code?
#include#includemain(){ int *a; a=(int*)malloc(sizeof(int)); *a=100; printf("*a%d",*a); free(a); a=(int*)malloc(sizeof(int)); *a=200; printf("a%p",a); *a=200; printf("a%d",*a);}

What will happens if the statement free(a) is removed in the following C code?

#include<stdio.h>#include<stdlib.h>main(){ int *a; a=(int*)malloc(sizeof(int)); *a=100; printf("*a%d",*a); free(a); a=(int*)malloc(sizeof(int)); *a=200; printf("a%p",a); *a=200; printf("a%d",*a);}
Correct Answer Memory leak

Related Questions

Comment on the following 2 C programs.
#include  //Program 1int main(){ int a; int b; int c;}#include  //Program 2int main(){ int a; { int b; } { int c; }}
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code: P → D* E* D → int ID {record that ID.lexeme is of type int} D → bool ID { record that ID.lexeme is of type bool} E → E1 + E2 {check that E1.type = E2.type = int; set E.type := int} E → !E1 {check that E1.type = bool; set E.type := bool} E → ID {set E.type := int} With respect to the above grammar; which one of the following choices is correct?