RAD Studio |  |

Structures And Functions

A function can return a structure type or a pointer to a structure type:

Copy Code

    mystruct func1(void);  // func1() returns a structure
    mystruct *func2(void); // func2() returns pointer to structure

A structure can be passed as an argument to a function in the following ways:

Copy Code

    void func1(mystruct s);        // directly
    void func2(mystruct *sptr);    // via a pointer
    void func3(mystruct &sref);    // as a reference (C++ only)

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!