Why is this causing a segmentation fault?

后端 未结 4 1642
伪装坚强ぢ
伪装坚强ぢ 2021-01-25 21:15

I\'ve been coding this in project in C++, normally I wouldn\'t have too much trouble with a segmentation fault, but I\'m new to C++. Basically I\'m making a pointer to an IntLis

4条回答
  •  隐瞒了意图╮
    2021-01-25 21:48

    Below line just defined a pointer, not malloc memory, so it's pointed to a random address in memory : IntList *x;

    When you try to assign the value "y" to it, program crashes.

提交回复
热议问题