I'm not able to correct the error "invalid use of void expression".
My background is in Basic and PIC but I have successfully ported several basic
PIC programs to C PIC.
Now I am trying ARM but cannot correct this simple error.
The Crossworks tutorial states "To correct the error, change the return type of
factorial from void to int in its prototype."
// CrossWorks Tutorial
#include
void factorial(int);
int main(void)
{
int i;
for (i = 0; i < 10; ++i)
debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line:
invalid use of void expression
return 0;
}
Norm
Crossworks beginner
Started by ●February 17, 2011
Reply by ●February 17, 20112011-02-17
Am 17.02.2011 08:52, schrieb normnet2003:
> I'm not able to correct the error "invalid use of void expression".
>
> My background is in Basic and PIC but I have successfully ported several basic PIC programs to C PIC.
> Now I am trying ARM but cannot correct this simple error.
Then you should go an buy a book on C and _read_ it. Then go back to the
tutorial.
> The Crossworks tutorial states "To correct the error, change the return type of factorial from void to int in its prototype."
Did you really read above line ?
--
42Bastian
+
| http://www.sciopta.com
| Fastest direct message passing kernel.
| IEC61508 certified.
+
> I'm not able to correct the error "invalid use of void expression".
>
> My background is in Basic and PIC but I have successfully ported several basic PIC programs to C PIC.
> Now I am trying ARM but cannot correct this simple error.
Then you should go an buy a book on C and _read_ it. Then go back to the
tutorial.
> The Crossworks tutorial states "To correct the error, change the return type of factorial from void to int in its prototype."
Did you really read above line ?
--
42Bastian
+
| http://www.sciopta.com
| Fastest direct message passing kernel.
| IEC61508 certified.
+
Reply by ●February 17, 20112011-02-17
Hello,
easy thing, not Crossworks related at all, basic C knowledge.
void factorial(int);
means the function factorial return nothing (!).
But with your debug_printf you print out the return value
of factorial.
Try something like
int factorial(int);
Best regards,
Martin
--- In l..., "normnet2003" wrote:
>
> I'm not able to correct the error "invalid use of void expression".
>
> My background is in Basic and PIC but I have successfully ported several basic PIC programs to C PIC.
> Now I am trying ARM but cannot correct this simple error.
> The Crossworks tutorial states "To correct the error, change the return type of factorial from void to int in its prototype."
>
> // CrossWorks Tutorial
>
> #include void factorial(int);
>
> int main(void)
> {
> int i;
> for (i = 0; i < 10; ++i)
> debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line: invalid use of void expression
> return 0;
> }
>
> Norm
>
easy thing, not Crossworks related at all, basic C knowledge.
void factorial(int);
means the function factorial return nothing (!).
But with your debug_printf you print out the return value
of factorial.
Try something like
int factorial(int);
Best regards,
Martin
--- In l..., "normnet2003" wrote:
>
> I'm not able to correct the error "invalid use of void expression".
>
> My background is in Basic and PIC but I have successfully ported several basic PIC programs to C PIC.
> Now I am trying ARM but cannot correct this simple error.
> The Crossworks tutorial states "To correct the error, change the return type of factorial from void to int in its prototype."
>
> // CrossWorks Tutorial
>
> #include void factorial(int);
>
> int main(void)
> {
> int i;
> for (i = 0; i < 10; ++i)
> debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line: invalid use of void expression
> return 0;
> }
>
> Norm
>
Reply by ●February 17, 20112011-02-17
On 17/02/2011 07:52, normnet2003 wrote:
> I'm not able to correct the error "invalid use of void expression".
>
> My background is in Basic and PIC but I have successfully ported several basic PIC programs to C PIC.
> Now I am trying ARM but cannot correct this simple error.
> The Crossworks tutorial states "To correct the error, change the return type of factorial from void to int in its prototype."
Buy a copy of The C Programming Language by Kernighan and Ritchie. All
wiil be explained!
Leon
--
Leon Heller
G1HSM
> I'm not able to correct the error "invalid use of void expression".
>
> My background is in Basic and PIC but I have successfully ported several basic PIC programs to C PIC.
> Now I am trying ARM but cannot correct this simple error.
> The Crossworks tutorial states "To correct the error, change the return type of factorial from void to int in its prototype."
Buy a copy of The C Programming Language by Kernighan and Ritchie. All
wiil be explained!
Leon
--
Leon Heller
G1HSM
Reply by ●February 17, 20112011-02-17
well recommended, a book that will not leave you for rest of your life....
________________________________
From: Leon Heller
To: l...
Sent: Thu, February 17, 2011 3:55:56 AM
Subject: Re: [lpc2000] Crossworks beginner
On 17/02/2011 07:52, normnet2003 wrote:
> I'm not able to correct the error "invalid use of void expression".
>
> My background is in Basic and PIC but I have successfully ported several basic
>PIC programs to C PIC.
> Now I am trying ARM but cannot correct this simple error.
> The Crossworks tutorial states "To correct the error, change the return type of
>factorial from void to int in its prototype."
Buy a copy of The C Programming Language by Kernighan and Ritchie. All
wiil be explained!
Leon
--
Leon Heller
G1HSM
________________________________
From: Leon Heller
To: l...
Sent: Thu, February 17, 2011 3:55:56 AM
Subject: Re: [lpc2000] Crossworks beginner
On 17/02/2011 07:52, normnet2003 wrote:
> I'm not able to correct the error "invalid use of void expression".
>
> My background is in Basic and PIC but I have successfully ported several basic
>PIC programs to C PIC.
> Now I am trying ARM but cannot correct this simple error.
> The Crossworks tutorial states "To correct the error, change the return type of
>factorial from void to int in its prototype."
Buy a copy of The C Programming Language by Kernighan and Ritchie. All
wiil be explained!
Leon
--
Leon Heller
G1HSM
Reply by ●February 17, 20112011-02-17
int factorial(int); was tried but no luck.
Norm
--- In l..., "capiman26061973" wrote:
>
> Hello,
>
> easy thing, not Crossworks related at all, basic C knowledge.
>
> void factorial(int);
>
> means the function factorial return nothing (!).
>
> But with your debug_printf you print out the return value
> of factorial.
>
> Try something like
>
> int factorial(int);
>
> Best regards,
>
> Martin
>
> --- In l..., "normnet2003" wrote:
> >
> > I'm not able to correct the error "invalid use of void expression".
> >
> > My background is in Basic and PIC but I have successfully ported several basic PIC programs to C PIC.
> > Now I am trying ARM but cannot correct this simple error.
> > The Crossworks tutorial states "To correct the error, change the return type of factorial from void to int in its prototype."
> >
> > // CrossWorks Tutorial
> >
> > #include
> >
> > void factorial(int);
> >
> > int main(void)
> > {
> > int i;
> > for (i = 0; i < 10; ++i)
> > debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line: invalid use of void expression
> > return 0;
> > }
> >
> > Norm
>
Norm
--- In l..., "capiman26061973" wrote:
>
> Hello,
>
> easy thing, not Crossworks related at all, basic C knowledge.
>
> void factorial(int);
>
> means the function factorial return nothing (!).
>
> But with your debug_printf you print out the return value
> of factorial.
>
> Try something like
>
> int factorial(int);
>
> Best regards,
>
> Martin
>
> --- In l..., "normnet2003" wrote:
> >
> > I'm not able to correct the error "invalid use of void expression".
> >
> > My background is in Basic and PIC but I have successfully ported several basic PIC programs to C PIC.
> > Now I am trying ARM but cannot correct this simple error.
> > The Crossworks tutorial states "To correct the error, change the return type of factorial from void to int in its prototype."
> >
> > // CrossWorks Tutorial
> >
> > #include
> >
> > void factorial(int);
> >
> > int main(void)
> > {
> > int i;
> > for (i = 0; i < 10; ++i)
> > debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line: invalid use of void expression
> > return 0;
> > }
> >
> > Norm
>
Reply by ●February 17, 20112011-02-17
Hi,
> int factorial(int); was tried but no luck.
The CrossWorks tutorial is designed to take you through fixing problems
using CrossWorks; once you fix this up, there are more things to fix up,
that's the way it's designed.
If you can't work through the tutorial, you need to go back to basics and
find a book on C, like this one:
Guy Steele is a man with a great pedigree.
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
SolderCore arriving Summer 2011! http://www.soldercore.com
> int factorial(int); was tried but no luck.
The CrossWorks tutorial is designed to take you through fixing problems
using CrossWorks; once you fix this up, there are more things to fix up,
that's the way it's designed.
If you can't work through the tutorial, you need to go back to basics and
find a book on C, like this one:
Guy Steele is a man with a great pedigree.
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
SolderCore arriving Summer 2011! http://www.soldercore.com
Reply by ●February 17, 20112011-02-17
On 17/02/2011 13:22, normnet2003 wrote:
>
>
> int factorial(int); was tried but no luck.
Apologies up front if this is a daft question - but did change the
function definition as well as the prototype?
Regards,
Richard.
+ http://www.FreeRTOS.org
Designed for Microcontrollers.
150,000 Downloads in Two Years.
>
> Norm
>
> --- In l... ,
> "capiman26061973" wrote:
>>
>> Hello,
>>
>> easy thing, not Crossworks related at all, basic C knowledge.
>>
>> void factorial(int);
>>
>> means the function factorial return nothing (!).
>>
>> But with your debug_printf you print out the return value
>> of factorial.
>>
>> Try something like
>>
>> int factorial(int);
>>
>> Best regards,
>>
>> Martin
>>
>> --- In l... ,
> "normnet2003" wrote:
>> >
>> > I'm not able to correct the error "invalid use of void expression".
>> >
>> > My background is in Basic and PIC but I have successfully ported
> several basic PIC programs to C PIC.
>> > Now I am trying ARM but cannot correct this simple error.
>> > The Crossworks tutorial states "To correct the error, change the
> return type of factorial from void to int in its prototype."
>> >
>> > // CrossWorks Tutorial
>> >
>> > #include
>> >
>> > void factorial(int);
>> >
>> > int main(void)
>> > {
>> > int i;
>> > for (i = 0; i < 10; ++i)
>> > debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this
> line: invalid use of void expression
>> > return 0;
>> > }
>> >
>> > Norm
>> >
>>
>
>
> int factorial(int); was tried but no luck.
Apologies up front if this is a daft question - but did change the
function definition as well as the prototype?
Regards,
Richard.
+ http://www.FreeRTOS.org
Designed for Microcontrollers.
150,000 Downloads in Two Years.
>
> Norm
>
> --- In l... ,
> "capiman26061973" wrote:
>>
>> Hello,
>>
>> easy thing, not Crossworks related at all, basic C knowledge.
>>
>> void factorial(int);
>>
>> means the function factorial return nothing (!).
>>
>> But with your debug_printf you print out the return value
>> of factorial.
>>
>> Try something like
>>
>> int factorial(int);
>>
>> Best regards,
>>
>> Martin
>>
>> --- In l... ,
> "normnet2003" wrote:
>> >
>> > I'm not able to correct the error "invalid use of void expression".
>> >
>> > My background is in Basic and PIC but I have successfully ported
> several basic PIC programs to C PIC.
>> > Now I am trying ARM but cannot correct this simple error.
>> > The Crossworks tutorial states "To correct the error, change the
> return type of factorial from void to int in its prototype."
>> >
>> > // CrossWorks Tutorial
>> >
>> > #include
>> >
>> > void factorial(int);
>> >
>> > int main(void)
>> > {
>> > int i;
>> > for (i = 0; i < 10; ++i)
>> > debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this
> line: invalid use of void expression
>> > return 0;
>> > }
>> >
>> > Norm
>> >
>>
Reply by ●February 17, 20112011-02-17
Hi Richard,
> On 17/02/2011 13:22, normnet2003 wrote:
> >
> >
> > int factorial(int); was tried but no luck.
>
> Apologies up front if this is a daft question - but did change the
> function definition as well as the prototype?
...the tutorial carries on with more things to fix up, so one assumes that
the tutorial hasn't been followed...
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
SolderCore arriving Summer 2011! http://www.soldercore.com
> On 17/02/2011 13:22, normnet2003 wrote:
> >
> >
> > int factorial(int); was tried but no luck.
>
> Apologies up front if this is a daft question - but did change the
> function definition as well as the prototype?
...the tutorial carries on with more things to fix up, so one assumes that
the tutorial hasn't been followed...
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
SolderCore arriving Summer 2011! http://www.soldercore.com
Reply by ●February 17, 20112011-02-17
On Thu, Feb 17, 2011 at 10:22 AM, normnet2003 wrote:
> int factorial(int); was tried but no luck.
>
Norm,
Did you try defining the factorial function somewhere?
I mean, not just declare "int factorial(int);" but also telling the
compiler what a factorial is supposed to do... Some research guys have been
trying to implement a crystal ball into the language but they are not quite
there yet... :-)
Cheers
--
Olivier Gautherot
o...@gautherot.net
>
> Norm
>
> --- In l..., "capiman26061973"
> wrote:
> >
> > Hello,
> >
> > easy thing, not Crossworks related at all, basic C knowledge.
> >
> > void factorial(int);
> >
> > means the function factorial return nothing (!).
> >
> > But with your debug_printf you print out the return value
> > of factorial.
> >
> > Try something like
> >
> > int factorial(int);
> >
> > Best regards,
> >
> > Martin
> >
> > --- In l..., "normnet2003" wrote:
> > >
> > > I'm not able to correct the error "invalid use of void expression".
> > >
> > > My background is in Basic and PIC but I have successfully ported
> several basic PIC programs to C PIC.
> > > Now I am trying ARM but cannot correct this simple error.
> > > The Crossworks tutorial states "To correct the error, change the return
> type of factorial from void to int in its prototype."
> > >
> > > // CrossWorks Tutorial
> > >
> > > #include
> > >
> > > void factorial(int);
> > >
> > > int main(void)
> > > {
> > > int i;
> > > for (i = 0; i < 10; ++i)
> > > debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line:
> invalid use of void expression
> > > return 0;
> > > }
> > >
> > > Norm
> > >
> >
>
> int factorial(int); was tried but no luck.
>
Norm,
Did you try defining the factorial function somewhere?
I mean, not just declare "int factorial(int);" but also telling the
compiler what a factorial is supposed to do... Some research guys have been
trying to implement a crystal ball into the language but they are not quite
there yet... :-)
Cheers
--
Olivier Gautherot
o...@gautherot.net
>
> Norm
>
> --- In l..., "capiman26061973"
> wrote:
> >
> > Hello,
> >
> > easy thing, not Crossworks related at all, basic C knowledge.
> >
> > void factorial(int);
> >
> > means the function factorial return nothing (!).
> >
> > But with your debug_printf you print out the return value
> > of factorial.
> >
> > Try something like
> >
> > int factorial(int);
> >
> > Best regards,
> >
> > Martin
> >
> > --- In l..., "normnet2003" wrote:
> > >
> > > I'm not able to correct the error "invalid use of void expression".
> > >
> > > My background is in Basic and PIC but I have successfully ported
> several basic PIC programs to C PIC.
> > > Now I am trying ARM but cannot correct this simple error.
> > > The Crossworks tutorial states "To correct the error, change the return
> type of factorial from void to int in its prototype."
> > >
> > > // CrossWorks Tutorial
> > >
> > > #include
> > >
> > > void factorial(int);
> > >
> > > int main(void)
> > > {
> > > int i;
> > > for (i = 0; i < 10; ++i)
> > > debug_printf("Factorial of %d is %d\n", i, factorial(i)); //this line:
> invalid use of void expression
> > > return 0;
> > > }
> > >
> > > Norm
> > >
> >
>