Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 10:22:54 +0000



Post From: Persistant SCString

[2014-08-20 23:42:38]
jackw - Posts: 57
Based on your example I wrote the short study I've attached to test out dynamically allocating memory.

When I allocate a single instance of the strucure, the programs compiles and runs fine.
student = (s_studentdata *) new s_studentdata;

When I allocate an array of the structure, the program still compiles and runs, but SC crashes when I remove the study or close the chartbook.
student = (s_studentdata *) new s_studentdata[10];


NEVERMIND!!! I figured out the problem. I was releasing the memory allocated to the array using the syntax 'delete' when I should have been using delete[]. You example code has the same error.

Date Time Of Last Edit: 2014-08-21 05:00:02
Attachment Deleted.
Attachment Deleted.
Attachment Deleted.