473,387 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

multidimensional array initializer costruct class

3
Hello to all. I have a problem for initialize an Array multidimensional, therefore I have seen from the forum, but it does not work correctly. An Array of 1024 allocations for 2 channels would serve me (left and rigth). that is:

double A [1024] [2];

myClass ()
{
public:
myClass()
{
s = 1024;

A = new double*[s];

for (int i=0;i<s;i++)
A[i]=new double[2];
}

private:
unsigned long s;
double **A;
}

Sbaglio qualche cosa?
Grazie ciao.
Sep 25 '06 #1
4 2201
scarbo
3
Hello to all. I have a problem for initialize an Array multidimensional, therefore I have seen from the forum, but it does not work correctly. An Array of 1024 allocations for 2 channels would serve me (left and rigth). that is:

double A [1024] [2];

myClass ()
{
public:
myClass()
{
s = 1024;
A = new double*[s];
for (int i=0;i<s;i++)
A[i]=new double[2];
}
private:
unsigned long s;
double **A;
}

Mistake some thing? Thanks hello.
Sep 25 '06 #2
Banfa
9,065 Expert Mod 8TB
Basically

Expand|Select|Wrap|Line Numbers
  1. myClass ()
  2. {
  3. // class definition
  4. }
  5.  
should be


Expand|Select|Wrap|Line Numbers
  1. class myClass
  2. {
  3. // class definition
  4. };
  5.  

Also it would be better if the type of i matched the type of s (i.e. unsigned long).

And Finally please don't double post.
Sep 25 '06 #3
scarbo
3
yes, is the banal forgetfulness is one. But the problem remains.
Sep 26 '06 #4
ltgbau
41
use
class myClass
{

instead
myClass ()
{
Sep 29 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: hrmadhu | last post by:
Hi, I am trying to write a template for an array which I can use to create multi-dimensional matrices as // A 10x10 matrix with each element initialized to 0 Array< Array<int> > Matrix (10,0);...
10
by: Ole | last post by:
Goodday everybody, i want to create an array that represents data, that has to be transferred to a pdf doc ( iTextSharp ). The problem is, that i seem too loose my faith. Namely, ( i have...
11
by: Joshua Russell | last post by:
Hi, I wish to parse an XML file into some sort or array or multidimensional storage. The XML file is as follows (without any parent tags just to give you an idea of the structure)... <Ship...
5
by: Wu | last post by:
Hi there, I was wondering whether there is a way to use array initializer syntax to initialize a non-static array member in a class in C++. In particular, if I have a class Foo: class Foo {...
10
by: | last post by:
I'm fairly new to ASP and must admit its proving a lot more unnecessarily complicated than the other languages I know. I feel this is because there aren't many good official resources out there to...
8
by: iluvatar | last post by:
Hi all. How can I initialize an array data member in the "faster" way? For example, suppose I have a class like class Example{ private: double array; public: Example(const double & val0,...
2
by: =?Utf-8?B?SmVucw==?= | last post by:
Hi, I have a multidimensional Array (2 dimensions). I'd like to hand that over to another function (respective another thread in another class, but that should be the same, shouldn't it?). ...
1
by: shailajaAdiga | last post by:
Hi All, there are 4 different categories which each month will bw updated. In each category(source),there are many editions. I have to display 6months updates. its like one is month array which...
9
by: Slain | last post by:
I need to convert a an array to a multidimensional one. Since I need to wrok with existing code, I need to modify a declaration which looks like this In the .h file int *x; in a initialize...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.