Is there a way to have two different expressions in a while loop?
I.e. something like:
while ((!doneyet) and (q<k))
What you want is "&&", which is the traditional C way of writing "and".
However, if you want to use "and" rather than "&&", you can:
#include <iso646.h>
That header defines a number of macros that expand into commonly used
operators, including a macro named 'and' which expands into "&&".
However, since this header was added to C90 in 1995; a few compilers
might not provide it. More importantly, those macros haven't proven to
be very popular, so most C programmers aren't very familiar with them.
In the long run you'll probably cause less confusion by using "&&"
rather than "and".
I tried while ((!doneyet), (q<k))
but the compiler says computed value not used and the program doesn't
work right. doneyet is a function that returns an int.
Well, in that case the expression (!doneyet) will convert "doneyet" into
a pointer to that function. !doneyet will check whether that pointer is
null. Since it points at an actual function, it can't be null, so
!doneyet will always have a value of 0, so the condition of your while()
loop will never be met.
I suspect that you actually mean !doneyet(), which actually calls the
function, and checks the value that it returns.