- 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
5 odpowiedzi
+ 16
you can't get help, without showing your code, copy and paste 👍😉
+ 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
+ 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 !!
+ 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.
+ 2
@Kirk Couldn't have said it better myself; that's spot on.