| Katma (32) | |||
|
I'm getting a segfault before the program even gets to main. It compiles just fine, but not beyond that. Here's the program. I cut out the functions to find the fault, and it doesn't seem to think it's in them.
Any and all help is appreciated! | |||
|
|
|||
| ResidentBiscuit (2645) | |
What compiler are you using?int A[n];I believe this works on G++ (I think they introduced this in C99) but doesn't on the Microsoft compiler. Either way, array size should be known at compile time, or the array should be dynamic. Same goes for the array AP[]. | |
|
|
|
| Peter87 (3912) | |
Make sure to flush cout, otherwise the output could be delayed and if a crash happens after you will not see the output at all.cout<<"A"<<endl; | |
|
|
|
| ne555 (4385) | |||
If you want to flush, then flush (endl will put an end of line)Or use an unbuffered stream, like cerr,for those debug messages Or learn to use a debugger You are probably accessing the array out-of-bounds, as your reading method is bugged
| |||
|
|
|||
| Katma (32) | |
|
I'm using the compiler built into my school's csc server. Linux classes.csc.lsu.edu 2.6.26-2-amd64 #1 SMP Tue Jan 12 22:12:20 UTC 2010 x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. I think Biscuit was right, though. When I gave it a size, it stopped giving me that particular problem. | |
|
|
|