![]() |
Can't use pointers nor refrences.
Has anyone had any sucess with using pointers or refrences? I thought MLAB was C '89 compleient, I thought pointers atleast were in the orignal C "release"
|
Re: Can't use pointers nor refrences.
Pointers worked fine for me, once I got the hang of the syntax. I don't often use C, and I find it very nonintuitive.
|
Re: Can't use pointers nor refrences.
Quote:
|
Re: Can't use pointers nor refrences.
Quote:
Code:
/*******************************************************************************"*input_value > 127" and "*input_value = 127" are references to the value stored where the pointer... uh... points. :o Later on in the same source file, you can find examples of how this function is called: Code:
Limit_Switch_Max(!rc_dig_in05, &pwm03);Does this help? If you can give us some clues about what you're trying to do with pointers (and how much you already know or don't know about pointers), I imagine we can be a little more helpful. |
Re: Can't use pointers nor refrences.
Sort of offtopic, but do you know why IFI used a pointer in the Limit_Switch_Max() function? I can't see any good reason except possibly to show that it could be done?
|
Re: Can't use pointers nor refrences.
Quote:
|
Re: Can't use pointers nor refrences.
Quote:
Or is that what you referring to? |
Re: Can't use pointers nor refrences.
Sorry, I should have been a bit more clear. I know they were passing it by pointer so they could change it inside the function, but I would have thought it better practice to return the value than output from inside the function. Isn't it good practice, in general, to have functions be as close to real mathematical functions as possible (one set of inputs always maps to the same outputs and the only outputs are what the function returns)
|
Re: Can't use pointers nor refrences.
Quote:
|
Re: Can't use pointers nor refrences.
Quote:
Steve |
| All times are GMT -5. The time now is 20:54. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi