Process returned -1073741819 (0xC0000005) with graphics.h

When i use the library for any code with methods from graphics, i get the error Process returned -1073741819 (0xC0000005). Why is this happening? and how to solve this memory leak problem

#include <graphics.h> 
int main() 
{ 
    initwindow(400,300); 
    moveto(0,0); 
    lineto(50,50); 
    getch(); 
    closegraph(); 
    return 0; 
}