Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
how to declare an array of objects without "new"
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Lionel, post: 2513323"] All you've done is created a pointer to nothing, it's not allocated any space. What you want is an array of pointers to HisClass objects: HisClass *hisObject[array_size]; This will create an array of length array_size, with each element allowing enough space for the size of a pointer to a HisClass object. [i] The compiler won't complain because it assumes you have done the right thing and allocated the memory. However, at run time your app tries to access memory that it is not allowed to or isn't a valid address and so you get the seg fault. Lionel.[/i] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
how to declare an array of objects without "new"
Top