Tuesday, November 18, 2014

C Debugging

What happens to the following program,

int main()
{
        char *a = malloc(sizeof(100));
        printf("a = %p\n",a);
        a++;
        printf("a = %p",a);
        free(a);
}

1 comment:

  1. When you try to delete a block of memory, by passing a valid address(other than the start address), the program crashes with a indicator "invalid pointer"

    ReplyDelete