LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-09-2006, 04:53 AM   #1
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Rep: Reputation: 35
How to work with **array?


Code:
class A {

};
Code:
class B {
    A *a;
};
And I had
Code:
class C {
    B *b[20];
};
That worked ok. But now I read amount of B from file.
So I set:
Code:
class C {
    B **b;
};
I tried to use b as used it previously, but it segfaults.
Then I tried
Code:
*b = new B[20]
But it segfaults either.
Can anyone tell me what to do?
Thanks.
 
Old 08-09-2006, 05:54 AM   #2
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
It turned out that I need:
Code:
b = new B*[20];
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
array c++ harrylee2003 Programming 3 10-14-2005 05:04 PM
Array help DropHit Linux - Software 0 06-30-2005 09:31 PM
Clariion External RAID Array wont work redwing25 Linux - Hardware 2 10-24-2004 08:09 PM
PERL: Size of an array of an Array inspleak Programming 2 03-10-2004 02:24 PM
RAID array not work after reboot smartsupport Linux - Hardware 0 11-19-2003 05:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration