@MK: I know the OP is not returning an array, because arrays are not returnable. The OP quite clearly wants to return an array, as is stated.
@MK: I know the OP is not returning an array, because arrays are not returnable. The OP quite clearly wants to return an array, as is stated.
Thank you for the quick reply, I will try some changes.
Would you suggest me to use a global variable to assign the resulting array from function?
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Returning the pointer to an array is quite involved (when the array is 2D, you need a loop and stuff). I still think it's a better idea to pass the original array to be filled in, into the function. (This may be allocated dynamically if required).
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
You can, but (1) I know it would take me at least three tries to get the syntax for that right and (2) even so, since array names are not assignable you can't do anything with it (like assign mouse as desired).
[Attempt 1:
But I don't think that's right, obviously.]Code:float *(bob(float param[12][3]))[12][3]
@op: Just pass in the array you want changed and change it inside the function.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
That's why it also says "and generally best"...are you trying to misquote me?
This reminds me of a story I heard once about three gunslingers in a darkened closet...maybe it was two gunslingers and a grizzly bear*.
* I think the punchline was "WHAT HAPPENED TO THE NEW G'DAM CAT?"
Last edited by MK27; 06-09-2009 at 04:51 PM.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
I do not think the OP does want that. I think "pass the resulting array" is a typo. The rest of the context pretty much implies we want a single float value. I am right*!
*it is because i & j are now out of bounds.
ps. "syntaxis" beat's brewbuck's "happenstance" for my word o' the day...
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge