Page 1 of 1

Bug in Printf

Posted: Wed Jul 23, 2008 10:20 pm
by tktech
I've just finished (almost implementing printf) and the only error is:

Code: Select all

printf.c:169: error: lvalue required as left operand of assignment
the line in question is:

Code: Select all

num = va_arg(args, unsigned long);
This is my only error left, any help would be appreciated ^^
This is standard of every other printf implementation I've seen, so why is it bugging out on cc?

Re: Bug in Printf

Posted: Wed Jul 23, 2008 10:35 pm
by stephenj
tktech wrote:I've just finished (almost implementing printf) and the only error is:

Code: Select all

printf.c:169: error: lvalue required as left operand of assignment
the line in question is:

Code: Select all

num = va_arg(args, unsigned long);
The problem being reported is that "unsigned long" expects a variable to be declared such as "unsigned long x"

Other than that, you shouldn't declare a variable as it is being passed.

Re: Bug in Printf

Posted: Wed Jul 23, 2008 10:59 pm
by tktech
Was a woops in my macros, fixed