Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in C Programming by (55.6k points)
recategorized by

Can anyone tell me what is Segmentation fault in C?

1 Answer

0 votes
by (119k points)

In C programming, a segmentation fault is a type of error caused if you try to access memory that “does not belong to you.”

When your code tries to perform read and write operation in a read-only location in memory or freed block of memory, this segmentation fault occurs.

 Common Segmentation fault scenarios:

  • Modifying a string Literal
  • Trying to access an address that is freed
  • Accessing out of array index bounds
  • Improper use of scanf()
  • Stack Overflow
  • Dereferencing uninitialized pointer

If you want to learn C programming, then check out this c programming online course by Intellipaat.

Also, watch this YouTube tutorial on C programming:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...