c++: pointers to pointers

Discussion in 'C++' started by A, Oct 28, 2003.

  1. A

    A Guest

    Hi,

    I have an array of pointers defined as such:

    myArray** ptr = new myArray[10];

    for some reason i get a compile time error stating there is no default
    constructor for myArray. The problem is that i should not need to define one
    since myArray is a pointer to a pointer and so should not have a default
    constructor - its a primitive data type and not an object.

    Any help appreciated.

    Regards,
    A
     
    A, Oct 28, 2003
    #1
    1. Advertising

  2. A wrote in news::

    > Hi,
    >
    > I have an array of pointers defined as such:
    >
    > myArray** ptr = new myArray[10];


    myArray** ptr = new myArray *[10];

    >
    > for some reason i get a compile time error stating there is no default
    > constructor for myArray. The problem is that i should not need to
    > define one since myArray is a pointer to a pointer and so should not
    > have a default constructor - its a primitive data type and not an
    > object.
    >


    HTH.

    Rob.
    --
    http://www.victim-prime.dsl.pipex.com/
     
    Rob Williscroft, Oct 28, 2003
    #2
    1. Advertising

  3. A

    A Guest


    >
    > > Hi,
    > >
    > > I have an array of pointers defined as such:
    > >
    > > myArray** ptr = new myArray[10];

    >
    > myArray** ptr = new myArray *[10];


    Bingo!

    Thanks Rob
     
    A, Oct 29, 2003
    #3
  4. A

    Alan Kelon Guest

    Hi,

    > > myArray** ptr = new myArray[10];

    >
    > myArray** ptr = new myArray *[10];
    >


    Or myArray* ptr = new myArray [10];

    Regards,
    Alan Kelon
     
    Alan Kelon, Oct 29, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Phil
    Replies:
    1
    Views:
    651
    llewelly
    Sep 16, 2003
  2. muser
    Replies:
    3
    Views:
    768
    Ron Natalie
    Sep 18, 2003
  3. Xamalek
    Replies:
    7
    Views:
    692
  4. Roger Leigh
    Replies:
    8
    Views:
    447
    Karl Heinz Buchegger
    Nov 17, 2003
  5. cerr

    pointers, pointers, pointers...

    cerr, Apr 7, 2011, in forum: C Programming
    Replies:
    12
    Views:
    683
Loading...

Share This Page