This is a discussion on Different Approaches Needed within the C and C++ forums, part of the Programming Talk category; What are the different ways a programmer of C programming language can pass arrays to functions? Kindly provide insight on ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
One of the approach is you can pass the array to a function by value. These can done in three ways depending on your needs and usage. It is
Put the array in a struct. Create a copy of the array in the calling function. Create a copy of the array in the called function. |
|
|||
|
To avoid the approach of calling a function that requires a long list of arguments one can store the variables into an array, then pass a POINTER to the array to the function. The array isn't actually passed to the function but just the array's location in the memory. This is known as PASS BY REFERENCE. The name of an array references the array's location in the memory, its ADDRESS.
|
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| urgent help needed | saranyan | USA Immigration | 1 | 05-01-2007 10:05 AM |
| Command or Option needed | Adrian | DB2 | 1 | 04-22-2007 12:50 PM |
| Urgent help needed | saranyan | Microsoft .NET | 1 | 04-03-2007 12:54 AM |
| Is Privilege Needed | Angela | Windows | 1 | 03-13-2007 11:21 PM |
| Documents needed for Green Card Processing | Vasu | Immigration Help | 1 | 10-11-2004 10:46 PM |