Hi, I can help a little bit but I don't guarantee it to be right also :D
1. Yes, only the first dimension can be omitted in the type
specification. But as I remember, array is allocated at compile time,
therefore in the definition all size must be specified.
int c[][3] = {1,2,3,4,5,6}; // the first dimension is implicitly set
to 2 (2x3 = 6);
int c[][3]; // this would probably cause error
int c[2][3]; // this will do
To have a dynamic multidimensional array use malloc with pointer
arithmetic.
2. To check the legality of the code, why not compile it yourself. And
for constructor definition, a C text book would serve well :D
3. There is a type of cast called reinterpret case which can
deconstantize a const.
Regards,
-Charles-
--- In [email protected], "Wont Tell :-P" <[EMAIL PROTECTED]> wrote:
>
> Hi ALL,
>
> I have a 4 Q's.
>
> Is it true that while creating a multidimentional array with
keyword NEW, all the array sizes must be supplied? Even if the first
dimension maybe a variable whose value maybe supplied at runtime but
all others must be constant, is that true?
>
> e.g,
>
> array_ptr = new int[][5][4];
>
> What if I want both/all of them to be dynamic?
>
> 2. class X {
> private:
> int m,n;
>
> public:
> show(int m, int n) {
> ---------------------------
> };
>
> void main()
> {
> X x;
> x.show(2,4);
> }
>
> Is the above statement legal? What will be its output?What is
usuage constructor and why is it must in C++ programming? What is
default contructor?
>
> 3. Can we change a constant numeric integer to its address or
reference usuing template?
>
> 4.template<class T> class FindMax&Mean {
> private:
> static T c;
> int;
> public:
> static void FindMean( T *M, T *N) {
> //-------------------
> }
> };...............
>
> void main() {
> int a,b;
> FindMan&Mean <int> M1;
> M1.FindMean(&a, &b);
> }
>
> Looking forward to learn from you all.