473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

What can cause Segmentation Fault on Linux?

Hi!
I am new in C. I got a lots of "Segmentation Fault"s in my code.
I guess One possibility is:
if " int array_i[10]; " is declard and the code trys to access
"array_i[10]",
a Segmentation Fault will be returned by gcc compiler on linux.

What are the other "major" reasons to have "Segmentation Fault"?
I hope this is not a stupid question and someone is will to give me
some exampls(part of code) with errors a newer might esasily make and
then gets "Segmentation Fault".
Thank you so much!

Nov 14 '05 #1
3 2100
I_have_nothing wrote:

Hi!
I am new in C. I got a lots of "Segmentation Fault"s in my code.
I guess One possibility is:
if " int array_i[10]; " is declard and the code trys to access
"array_i[10]",
a Segmentation Fault will be returned by gcc compiler on linux.

What are the other "major" reasons to have "Segmentation Fault"?


That's the classic reason:
Attempting to access memory that the program doesn't own.

You are aware that array_i[10] is undefined in your program, right?

--
pete
Nov 14 '05 #2
Thanks!
Any OTHER major/classic reason?

Nov 14 '05 #3

I_have_nothing wrote:
Thanks!
Any OTHER major/classic reason?


SEGV is usually caused by some form of illegal memory access. Trying to
list all the possible causes of this error, however, would be like
trying to list all the reasons why your car could break down while
driving.

Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Narendran Kumaraguru Nathan | last post by:
Hi all, I am fairly experianced in C. I am writing a program in which I'm getting a segmentation fault. The problem is that it is getting the segmentation fault when executing calloc. I tried...
6
by: I_have_nothing | last post by:
Hi! I am new in C. I try to use dynamical allocation fuction malloc( ) and realloc( ). I found something strange. After several calling realloc( ), the malloc( ) will give me a Segmentation...
5
by: Fra-it | last post by:
Hi everybody, I'm trying to make the following code running properly, but I can't get rid of the "SEGMENTATION FAULT" error message when executing. Reading some messages posted earlier, I...
5
by: silverburgh.meryl | last post by:
Hi, I have a segmentation fault in line 66 of GroupResult.h and I can't figure out why that causes any problem, I appreciate if anyone can help. line 66 of Result.h: 66 size_t size()...
3
by: Kiran | last post by:
Hello All, In my program, I have a main thread which is the GUI (wxPython) and then a thread which goes and reads data from a socket. The reason this is in a different thread is because the data...
0
by: jgarber | last post by:
Hello, I just upgraded MySQLdb to the 1.2.0 version provided by Redhat Enterprise Linux ES4. At that point I began to get segfaults when importing twisted after MySQLdb, but not before. --...
8
by: lawrence k | last post by:
We made some changes to our server yesterday, and ever since, every single installation of WordPress that was on the server has stopped running. Other PHP scripts still run fine, but WordPress is...
3
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection...
2
by: Nagaraj | last post by:
Hi all, I am new to Linux platform. I am writing some C programs on Linux platform. It gives the segmentation fault error, what is segmentation fault and how to remove it. please reply.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.