Например:<br>
main.cpp<br> --------------------<br> #include <stdio.h><br> #include <stdlib.h><br> <br> int main(void)<br> {<br> int a[2];<br> a[0] = 2;<br> a[1] = 2;<br> a[2] = 2;<br> a[3] = 1;<br>
return 0;<br> }<br> --------------------<br><br>
$ g++ -g main.cpp<br><br>
$ ./a.out<br> segmentation fault (core dumped) ./a.out<br><br>
$ gdb a.out core<br> GNU gdb 19991004<br> Copyright 1998 Free Software Foundation, Inc.<br> GDB is free software, covered by the GNU General Public License, and you are<br> welcome to change it and/or distribute copies of it under certain conditions.<br> Type "show copying" to see the conditions.<br> There is absolutely no warranty for GDB. Type "show warranty" for details.<br> This GDB was configured as "i386-redhat-linux"...<br> Core was generated by `./a.out'.<br> Program terminated with signal 11, Segmentation fault.<br> Reading symbols from /usr/lib/libstdc++-libc6.1-1.so.2...done.<br> Reading symbols from /lib/libm.so.6...done.<br> Reading symbols from /lib/libc.so.6...done.<br> Reading symbols from /lib/ld-linux.so.2...done.<br> #0 0x1 in ?? ()<br> (gdb)<br><br>
и где же ошибка? - не понятно ...<br>