Вывод valgrind:
==2766== Invalid write of size 1
==2766== at 0x80485B9: main (2.c:17)
==2766== Address 0xbece8000 is not stack'd, malloc'd or (recently) free'd
==2766==
==2766==
==2766== Process terminating with default action of signal 11 (SIGSEGV)
==2766== Access not within mapped region at address 0xBECE8000
==2766== at 0x80485B9: main (2.c:17)
==2766== If you believe this happened as a result of a stack
==2766== overflow in your program's main thread (unlikely but
==2766== possible), you can try to increase the size of the
==2766== main thread stack using the --main-stacksize= flag.
==2766== The main thread stack size used in this run was 8388608.
==2766==
==2766== HEAP SUMMARY:
==2766== in use at exit: 10,400 bytes in 1 blocks
==2766== total heap usage: 1 allocs, 0 frees, 10,400 bytes allocated
==2766==
==2766== LEAK SUMMARY:
==2766== definitely lost: 0 bytes in 0 blocks
==2766== indirectly lost: 0 bytes in 0 blocks
==2766== possibly lost: 0 bytes in 0 blocks
==2766== still reachable: 10,400 bytes in 1 blocks
==2766== suppressed: 0 bytes in 0 blocks
==2766== Reachable blocks (those to which a pointer was found) are not shown.
==2766== To see them, rerun with: --leak-check=full --show-reachable=yes
==2766==
==2766== For counts of detected and suppressed errors, rerun with: -v
==2766== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 13 from 8)
Вывод valgrind:
==2766== Invalid write of size 1
==2766== at 0x80485B9: main (2.c:17)
==2766== Address 0xbece8000 is not stack'd, malloc'd or (recently) free'd
==2766==
==2766==
==2766== Process terminating with default action of signal 11 (SIGSEGV)
==2766== Access not within mapped region at address 0xBECE8000
==2766== at 0x80485B9: main (2.c:17)
==2766== If you believe this happened as a result of a stack
==2766== overflow in your program's main thread (unlikely but
==2766== possible), you can try to increase the size of the
==2766== main thread stack using the --main-stacksize= flag.
==2766== The main thread stack size used in this run was 8388608.
==2766==
==2766== HEAP SUMMARY:
==2766== in use at exit: 10,400 bytes in 1 blocks
==2766== total heap usage: 1 allocs, 0 frees, 10,400 bytes allocated
==2766==
==2766== LEAK SUMMARY:
==2766== definitely lost: 0 bytes in 0 blocks
==2766== indirectly lost: 0 bytes in 0 blocks
==2766== possibly lost: 0 bytes in 0 blocks
==2766== still reachable: 10,400 bytes in 1 blocks
==2766== suppressed: 0 bytes in 0 blocks
==2766== Reachable blocks (those to which a pointer was found) are not shown.
==2766== To see them, rerun with: --leak-check=full --show-reachable=yes
==2766==
==2766== For counts of detected and suppressed errors, rerun with: -v
==2766== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 13 from 8)
P.S. Что то codebox не работает
На С++ это делать проще.. Интересный вопрос - хочу сделать (или найти написанную) матричную библиотеку на С++ оптимально работающую.
в строке 11 написано присвоение нового адреса (адреса каждой строки) - это если я правильно понял автора.
Как я думаю, нужно сначала выделить массив "одномерный" (0-й столбец) для типа char* размером SIZE элементов, чтоб хранить указатели на строки
Вывод valgrind:
==2766== Invalid write of size 1
==2766== at 0x80485B9: main (2.c:17)
==2766== Address 0xbece8000 is not stack'd, malloc'd or (recently) free'd
==2766==
==2766==
==2766== Process terminating with default action of signal 11 (SIGSEGV)
==2766== Access not within mapped region at address 0xBECE8000
==2766== at 0x80485B9: main (2.c:17)
==2766== If you believe this happened as a result of a stack
==2766== overflow in your program's main thread (unlikely but
==2766== possible), you can try to increase the size of the
==2766== main thread stack using the --main-stacksize= flag.
==2766== The main thread stack size used in this run was 8388608.
==2766==
==2766== HEAP SUMMARY:
==2766== in use at exit: 10,400 bytes in 1 blocks
==2766== total heap usage: 1 allocs, 0 frees, 10,400 bytes allocated
==2766==
==2766== LEAK SUMMARY:
==2766== definitely lost: 0 bytes in 0 blocks
==2766== indirectly lost: 0 bytes in 0 blocks
==2766== possibly lost: 0 bytes in 0 blocks
==2766== still reachable: 10,400 bytes in 1 blocks
==2766== suppressed: 0 bytes in 0 blocks
==2766== Reachable blocks (those to which a pointer was found) are not shown.
==2766== To see them, rerun with: --leak-check=full --show-reachable=yes
==2766==
==2766== For counts of detected and suppressed errors, rerun with: -v
==2766== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 13 from 8)
P.S. Что то codebox не работает
попробовал присвоить значение переменной SIZE не через параметр. работает. может нужно