Thread: Passing pointer to array

  1. #1

    Passing pointer to array

    I have an array of structs, how can I pass a pointer to it? I keep getting all sorts of errors.

    I was thinking I should just have it like

    mys = new MYSTRUCT[30];

    And pass it like that, but I tried that and my program shutdown immediately and gave no error!

  2. #2
    Registered User
    Join Date
    Feb 2004
    no.... this is wrong

    try the following

    MYSTRUCT *mys=new MYSTRUCT[30];

    MYSTRUCT *mys;
    mys = new MYSTRUCT[30];
    hope it works

  3. #3
    Ok it works, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem passing pointer array
    By broli86 in forum C Programming
    Replies: 10
    Last Post: 06-30-2008, 11:27 AM
  2. Passing a pointer to two-dimension array in a function
    By E_I_S in forum C++ Programming
    Replies: 11
    Last Post: 06-19-2008, 09:57 AM
  3. Quick Pointer Question
    By gwarf420 in forum C Programming
    Replies: 15
    Last Post: 06-01-2008, 03:47 PM
  4. Compiler "Warnings"
    By Jeremy G in forum A Brief History of
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM
  5. Dynamic pointer array in C
    By MacFromOK in forum Windows Programming
    Replies: 14
    Last Post: 04-09-2005, 06:14 AM