![]() |
|
#1
|
|||
|
|||
Help with segmentation faultHi guys , im working on a calculator programn and i kept getting this segmentation fault when i run it , This is my code , can someone give me a hand on what is wrong with it , thank you.
stack.h CPP / C++ / C Code:
stack.c: CPP / C++ / C Code:
Last edited by LuciWiz : 26-Mar-2006 at 09:45.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#2
|
|||
|
|||
|
Quote:
For reasonable expectation of help, you should tell us: 1. What is the program supposed to do (I know, you said it is a calculator, but I mean specifically: what kind of expressions it is supposed to process; infix notation? postfix? --- what?) 2. What input(s) did you give it? Show us exactly what you entered. 3. What did you expect the program to do? 4. What did it do? (I know --- you said it crashed, but did it do anything before it crashed? Did it always crash, or just sometimes?) Now, here's a method that can (sometimes) let you get to the bottom of things instead of having to wait for someone else to respond: Put printf() statements at various places in the program. This does two things: (a) It might let you know where the problem is. (That is how far did it get before the crash.) (b) You can make the printf() statements tell you what the program is working on at any given step (sometimes it's not seeing what you think it is). For example CPP / C++ / C Code:
and CPP / C++ / C Code:
These are just a couple of places to put the printf() statements. Put lots of printf() until you see exactly where things are going wrong. Regards, Dave |
Recent GIDBlog
US Elections and the ?Voter?s Responsibility? by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| segmentation fault in c++ | rushman8282 | C++ Forum | 2 | 26-Jan-2005 04:38 |
| Segmentation Fault? | aaroncohn | C++ Forum | 2 | 02-Jan-2005 15:22 |
| Why seg fault in char array? | nusstu | C Programming Language | 11 | 24-Aug-2004 17:10 |
| Need a help with C code-Segmentation Fault | nkhambal | C Programming Language | 13 | 18-Jul-2004 15:58 |
| child pid xxx exit signal Segmentation fault (11) | bezak | Apache Web Server Forum | 1 | 24-Nov-2003 10:18 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The