Simulation leads to dump? [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am a newbie for C and need help to figure out the problem when I did simulation.
It works very well when I run 10 times simulation. However, the error message shows segementation fault (core dumped) when I run 100 times simulation. Thank you for your help in advance for helping to solve this problem.
BTW, my code is really long (around 1000 lines) and ugly. If who can help, I am more than happy to offer my code for your review.
Thanks,
Jane

I think you need to add trace printing and/or learn how to use a debugger like GDB and its GUI front-end DDD. You need to test your code and nail down where it fails and learn proper debugging techniques.
You can not just look at all your code like a box and say that it does not work. You need to establish what works and what is not working.
A segfault means that you are handling memory wrong somewhere, accessing memory that are outside of the memory this program is allowed to access.
Since this is a beginner question I will take the opportunity to promote my suggested Q&A site for beginner programmers. Where simple questions are OK and met with a positive constructive advice. If you like the idea become a follower

Related

Console Based Calculation For Super Human Mind Training? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Thanks for giving me your valuable time, I wanna create a Brain Calculation Package. Basically, I will generate random numbers and throw it to user and user will enter the result. This will test his accuracy and will make him more sharp.
But, I am pretty confused to use what sort of programming language. My aim is to make the user to calculate digits till 100 digits with time. Please throw some light on this.
What sort of algorithms and strategies can i use?
Are there any other programs available currently to achieve this?
I have no idea what you're trying to do. But if I were drunk and wanted to spit out random numbers, I'd probably use Python.

how to write a web browser from stratch use c [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
These days I'm aware of the powerful web browser. In order to know what happend behind the screen. I want to write a simple web browser. But When I try to find document about that. Nothing find! Any one konw how to write a simple web browser or know where is the book will be useful. Please tell me !
Thank you very much!
Start off with a simple browser -- e.g., look at existing text only ones like lynx or w3m. Once you've got them cracked, then you can work up to adding graphical elements. It can get complicated fairly quickly, so make sure you've read the appropriate RFCs for HTTP and the W3C standards as well. These aren't light reading material though :-)
Here's something to get you started:
https://developer.mozilla.org/en/Download_Mozilla_Source_Code
C might not be the best language for this job.

Useful Source Code Examples of C? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm currently delving into learning C and whilst I'm not far into the process, I'd like some examples of fully-functioning windows applications complete with source code that aren't too complicated to study - things like calculator/notepad?
Anybody got any links to where I might find a good few examples beyond the 'converting kgs to stones' or calculating speed from time and distance?
Would certainly help my inspiration. :D
Thanks.
Did not answer exactly what you asked,but ...
Tring to solve some Euler problems is a good way to familiar with the language features.
http://projecteuler.net/
If you want examples of existing C projects, browse github/sourceforge.
I wonder though - why do you want to learn C? Seeing as you're new to C, I'm assuming you might actually mean C++.
What background are you coming from and what do you want to achieve? If you want to try some algorithms, pierr's answer is a good one to get used to any language. Also, if you're interested in learning the language detail/algorithms, avoid shiny UI temptation and stick with the command line.
If you're starting programming for the first time, glenn's answer is a good start.
If you're just interested in Windows application development, this MS tutorial looks like a good start.
If you are moving from another language, look for a specific guide (e.g. Java to C++) to fill you in on the details quickly.
There are multiple websites with numerous tutorials:
C programming
C tutor
Also, be sure to look into pointers:
something on pointers
Hope this helps

How to start programming? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I read a lot of books about C/C++ in Linux and write simple programs. Now I want to try myself with some project. What you can recommend to? (Sorry for my bad English)
If you don't know what to do and just want to get a little experience, try implementing the towers of Hanoi, it's a classical programming exercise (the Wikipedia article might seem frightening at first sight, but the actual algorithm is dead-simple and you'll find lots of material about it online, even a lot of sample implementations). First, start with a text-only solution that just prints numbers. Then, try to "draw" the towers using ASCII art. You can also do this with a GUI, but as a novice it's easiest to start with text-based version.

error after running for few minutes [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
kindly tell me that is it possible that i run a program at an intervel of 30 sec ,run for some time and give error which was previously not given ? thanks
how to stop this
if my question is wrong kindly dont vote me down
just tell me my intention is not to hurt any one nor ask stupid question as i really appreciate you guys
thanks
Yes, it is possible for a program to work for a period of time and then fail.
Have you tried Valgrind?
Yes, it's possible. Just because your program appears to "work" doesn't mean that it does not have bugs.
There are many types of mistakes that you can make, especially when working with memory (pointers, arrays, and the like), that may sometimes silently work anyway, and at other times may completely crash. It's largely arbitrary, based on whatever values happen to be present in memory at the addresses that you are erroneously accessing.
Use a tool like Valgrind and/or GDB to debug these sorts of issues.
It's not specific enough to answer without more details. However, the best thing for you to do would be to use a debugger to run your program in so you can examine what it's doing when it dies, a problem occurs, or to just help you walk through it. GDB is a popular free debugger.

Resources