valgrind lab

  1. install valgrind
  2. check the following  code:
#include<stdio.h>
#include<stdlib.h>

void main(void)
{
	int i;
	int *p1,*p2,*p3;
	int *p = (int *)malloc(100);
	p--;
	printf("%d\n",*p);
	p1 = (int *)malloc(200);
	p1--;
	printf("%d\n",*p1);
	p2 = (int *)malloc(300);
	printf("%d\n",*p2);
	free((void*)p2);
	*p2=90;
}