How to return a multidimensional array with a pointer function?

This is a discussion on How to return a multidimensional array with a pointer function? within the C++ Programming forums, part of the General Programming Boards category; Hello, I would like to return a multidimensional array from a pointer function.But multidimensional array dimension's will be enormous.For example,width ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    6

    How to return a multidimensional array with a pointer function?

    Hello,

    I would like to return a multidimensional array from a pointer function.But multidimensional array dimension's will be enormous.For example,width will be 500 and height will be 600.

    Could you help me please?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,456
    Pass the array to the function, then modify the array in the function. If you are using a container instead, pass the container by reference.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,455
    Side note: if you used functors instead of function pointers, then you could return a vector from the functor and hopefully the compiler will optimize it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 05-29-2009, 05:48 AM
  2. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  3. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  4. Replies: 8
    Last Post: 03-10-2008, 11:57 AM
  5. Another weird error
    By rwmarsh in forum Game Programming
    Replies: 4
    Last Post: 09-24-2006, 10:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21