- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
List of Common Reasons for Segmentation Faults in C/C++
The main reason for segmentation fault is accessing memory that is either not initialized, out of bounds for your program or trying to modify string literals. These may cause a segmentation fault though it is not guaranteed that they will cause a segmentation fault. Here are some of the common reasons for segmentation faults −
- Accessing an array out of bounds
- Dereferencing NULL pointers
- Dereferencing freed memory
- Dereferencing uninitialized pointers
- Incorrect use of the "&" (address of) and "*" (dereferencing) operators
- Improper formatting specifiers in printf and scanf statements
- Stack overflow
- Writing to read-only memory
- Related Articles
- Common Faults and Treatment Methods of Fluorescent Lamp
- Core Dump (Segmentation fault) in C/C++
- What is a segmentation fault in C/C++?
- What is a segmentation fault in C/C++ program?
- Reasons for a C++ program crash
- List the reasons for the destruction of forests.
- How to find Segmentation Error in C & C++ ? (Using GDB)
- Is segmentation fault actual undefined behavior in C++?
- C++ Program for Common Divisors of Two Numbers?
- C++ Program for Longest Common Subsequence
- List of C++ IDEs for Linux
- C++ Program for the Common Divisors of Two Numbers?
- Find the common nodes in two singly linked list in C++
- Minimum Index Sum for Common Elements of Two Lists in C++
- Find minimum shift for longest common prefix in C++

Advertisements