I'm very new to C, but have no idea why this program breaks. The program compiles and runs if I remove the lines that have to do with i, but if I assign i, I can no longer assign anything to *ptr without the program breaking.

int main(void)
{
    int i;
    int *ptr;

    i = 2;
    *ptr = 5;
    printf("%d",*ptr);
}
Edit
Report