A segmentation fault occurs mainly when our code tries to access some memory location which it is not supposed to access.
· Working on Dangling pointer
· Freeing the memory twice
· Running out of memory(stack or heap)
· Improper format control string in printf or scanf statements
· Failure to initialize a pointer before accessing it