Subject:
|
Re: NXC - embedded functions failed
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Mon, 21 May 2007 16:22:11 GMT
|
Viewed:
|
20411 times
|
| |
| |
In lugnet.robotics.nxt, Elizabeth Mabrey wrote:
> Prob = Max(33, Max(5,15));
>
> NumOut(5,LCD_LINE2,false,Prob); //returns 15 WRONG
This is definitely a problem in NXC. The problem is that the value of arg "a"
(33) to the function Max is being replaced during the second call to Max since
it passes 5 into arg "a". It looks like I need to figure out a decent way to
implement an argument stack which is probably going to be excruciatingly
difficult.
If anybody has some really good ideas about this sort of thing I am open to
suggestions.
John Hansen
|
|
Message is in Reply To:
| | NXC - embedded functions failed
|
| #include "NXCDefs.h" int Max(int a,int b){ if (a>b) return a; else return b; } task main(){ int Prob=0; Prob = Max(33, Max(5,15)); NumOut(5,LCD_LINE2,false,Prob); //returns 15 WRONG ---...--- Prob = Max(5,15); Prob = Max(33,Prob); (...) (18 years ago, 20-May-07, to lugnet.robotics.nxt)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in NXT programmable brick
|
|
|
|