Updated
This is a basic programming doubt, i just started to learn c and c++
i have two loops i.e.
if (n==null)
{
do loop 1
}
else //(n!=null)
{
do loop2
}
now I have to update the above code, with a single loop i.e. when n==null or n!=null do the loop 1 alone
how can i update.?
can i do like this
while(n==null || n!=null)
{
do loop 1
}
is || operator above does the job what i expected?
Note that
is an infinite loop because
n==null || n!=nullis always true.Probably you mean
which for the above remark is simply
In any case I suggest you to give a look to the Truth Tables.