Hello
can anyone help,,,
I need to return an array of structures from a function after I handle it and change it...
so my function accepts the array of structures as an argument and I want to return it...
please help ...
Hello
can anyone help,,,
I need to return an array of structures from a function after I handle it and change it...
so my function accepts the array of structures as an argument and I want to return it...
please help ...
arrays are automatically passed by reference. Any changes you make to the array in the function will be reflected back to the calling function.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
You don't have to return it since an array parameter is converted to a pointer to the first element, any changes you make would be seen in the calling function anyway. But I've had plenty of times where I also returned the array for notational convenience, so you'd do it like thisneed to return an array of structures from a function after I handle it and change it...
so my function accepts the array of structures as an argument and I want to return it...
Code:struct T *f(struct T *t) { /* ... */ return t; }