I used to like programing but now i kinda dislike it......the errors are undetectable(segmentation faults). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

I used to like programing but now i kinda dislike it......the errors are undetectable(segmentation faults).

I stare at the screen for hours and hours but still don't get the segmentation fault...... my heart is slowly filling with hatredism for programing....... somebody PLEASE HELP!!!!!!! PLEASE HELP!!!!!! PLEASE HELP

6th Nov 2017, 3:38 PM
Gokul Krishna
Gokul Krishna - avatar
5 Answers
+ 16
you can't get help, without showing your code, copy and paste 👍😉
6th Nov 2017, 4:09 PM
tooselfish
tooselfish - avatar
+ 6
A segfault means you're trying to access protected memory outside of your program's assigned 'memory segment'. This can be a security problem, crash the OS or destroy data. This is actually helping you, by letting you continue without losing work. In this language it is really important that you study pointers, how variables are initialized (or aren't), what is meant by "by-reference" and "by-value" and what the symbols *, & and ** are doing. You also have to keep track of how big things are and stay within safe boundaries. You could keep fixing your program -- but getting it working won't feel right without understanding why... so (if you don't switch languages) you could stop, repeat those basics (even memcopy, malloc and free) and play with each of these concepts in tiny programs until you understand them. For example, these programs do something cute... but in the wrong way (the opportunity to point this out is one reason I write these). Would you like to guess what's wrong? https://code.sololearn.com/cXQkq9TeESol/?ref=app https://code.sololearn.com/cRzqbfwyP2rJ/?ref=app
6th Nov 2017, 6:51 PM
Kirk Schafer
Kirk Schafer - avatar
+ 4
1.) stop staring at the screen! If you dont find an error after 5 minutes, take a break. do some sports but dont watch tv or youtube 2.) learn using a debugger 3.)how can a silly program be so mighty to bent you? you are Gokul Krishna ! Level6 !!
6th Nov 2017, 4:01 PM
Oma Falk
Oma Falk - avatar
+ 4
Java and C# already handle garbage collection easily "right out the box." This is part of why many people recommend beginners to start with something like Java/C# first, and then tackle C++ once you have a better understanding of programming in general and how memory works.
6th Nov 2017, 4:06 PM
AgentSmith
+ 2
@Kirk Couldn't have said it better myself; that's spot on.
6th Nov 2017, 7:35 PM
AgentSmith