Forgetting to delete memory.
Using an object after it was deleted.
Deleting the same memory twice.
Segmentation faults occur when you try to use memory which does not belong to you.
Typically out of bounds array references. eference through un-initialized or dangling pointers, the latter being pointers to already freed memory.
char *s = “Hello”;
*s=‘H’;
Compiled with g++ we get a warning and we get a seg. fault at run time. Segmentation faults are to do with memory access violations.
You aren’t allowed to access the memory specified.
A compiler won’t necessarily care or help.
Bus faults are similarly run time problems to do with accessing memory. But it relates to trying to access memory that cannot be physically addressed. The memory is invalid for the access type specified, usually to do with memory misalignment.