On 02/11/11 15:33, David C. Rankin wrote:
So where is this segfault coming from?
gdb --args ./a.out 1 2 3 4 Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7a88b03 in ____strtod_l_internal () from /lib64/libc.so.6 (gdb) bt full #0 0x00007ffff7a88b03 in ____strtod_l_internal () from /lib64/libc.so.6 No symbol table info available. #1 0x00000000004006d1 in main (argc=5, argv=0x7fffffffda78) at dcr.c:19 p = 0x7fffffffdf72 "" i = 5 rad = 4 area = 50.26548245743669 (gdb) frame 1 #1 0x00000000004006d1 in main (argc=5, argv=0x7fffffffda78) at dcr.c:19 19 rad = strtod(argv[i],&p); (gdb) p argv[i] $1 = 0x0 --> that's why ! argv[argc] is a null pointer! bug is for (i=1;i<= argc;i++) { ^^ should be < argc -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org