Subject:
|
Re: IC trouble - function definition
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sat, 13 Nov 1999 15:28:23 GMT
|
Original-From:
|
Richard Drushel <drushel@apk.net(Spamcake)>
|
Viewed:
|
863 times
|
| |
| |
[John Bachman] spake unto the ether:
> /* A simplified program to figure out what is wrong */
>
> long time;
>
> void start()
> {
> phony();
>
> void phony() /* Line 9 syntax error is reported here */
> {
> while (digital(2) == 1)
> {
> time = mseconds();
> }
> }
> }
>
> When I try to load it with IC I get a syntax error on line 9. Can anyone tell me why?
You have the definition of phony() nested inside the definition
of start(). I don't know what ANSI C and/or C++ let you do, but this is
invalid IC. You need something like:
long time;
void start()
{
phony();
}
void phony()
{
while (digital(2)==1)
{
time = mseconds();
}
}
Of course, somewhere you will need a main() to call start().
*Rich*
--
Richard F. Drushel, Ph.D. | "Aplysia californica" is your taxonomic
Department of Biology, Slug Division | nomenclature. / A slug, by any other
Case Western Reserve University | name, is still a slug by nature.
Cleveland, Ohio 44106-7080 U.S.A. | -- apologies to Data, "Ode to Spot"
|
|
Message is in Reply To:
| | Re: IC trouble - function definition
|
| Thanks for all the helpful device but the darned thing still does not work. I have created a simplified program to try to figure out what I am doing wrong. Here it is: /* A simplified program to figure out what is wrong */ long time; void start() { (...) (25 years ago, 13-Nov-99, to lugnet.robotics.handyboard)
|
7 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|