Returning Pointer To Pointer From Function 
Author Message
 Returning Pointer To Pointer From Function

: I would appreciate some advice on how to correctly write a function
: prototype, and how to use the variable that was passed.  I'll explain
: what the situation is.  Before I gave up on this, I was getting syntax
: errors no matter what I tried.

: At the top of the program, I set up a define
: "define TYPE_16BIT_UNSIGNED unsigned small".  In a function, I used
: malloc to get a pointer to an array of TYPE_16BIT_UNSIGNED.  This was a one
: dimensional array which stored a two dimensional image, one row after the
: other.  In the function, I used malloc to allocate memory for an array of
: pointers to variables of type TYPE_16BIT_UNSIGNED.  Each element in the
: pointer array was then initialized to point to the first element of a row
: in the first array.  What I couldn't figure out was how to set up the
: function prototype so that I could return the pointer to the image array,
: and the pointer to the array of pointers.

: If the variables were local to the function, I think that the definitions
: would be similar to:

: TYPE_16BIT_UNSIGNED *image_ptr;  /* pointer to image array */
: TYPE_16BIT_UNSIGNED **image_row_ptr;  /* pointer to array of row pointers */

: After initialization, I could access elements in the image array by writing:

: image_row_ptr[i][j] = 0;

: But, the compiler didn't seem to like me defining the image_row_ptr in
: the function prototype as:

: TYPE_16BIT_UNSIGNED ***image_row_ptr

: Does anyone have a suggestion?  Please send it to me by e-mail if you
: do.  Thanks.

: --

: ============================================================================

: Systems Analyst II                     | WWW: http://www.*-*-*.com/ ~clscott/
: Computing Services - SUB203C           | Voice: (501) 569-3342
: University of Arkansas at Little Rock  |
: Little Rock, AR  72204                 |
: ============================================================================

***************begin r.s. response******************

        try using a
        rather than
        for this ...

***************end r.s. response********************
Ralph Silverman

Fri, 01 Oct 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. ISO C Binding: Pointer to a pointer of pointers: ***argv

2. Call Library Function returning a pointer to doubles

3. returning base class pointer from function

4. F90 problem compiling function returning pointer array

5. NT & C function returning pointer

6. HELP F90, External function returning pointer

7. functions returning (pointer to) subroutine?

8. Calling a dll c function returning a pointer

9. Function pointer as function parameter

10. tcl+C function with pointer function argument?

11. Pointers to pointers possible?

12. A pointer to an array of pointers


Powered by phpBB® Forum Software