Here is code which i am using Please check it first

for(x=0; x<=y; x++){
if(a=x||b=x||c=x){
printf("Value =%d",x);
}
}

In this code x is a base for the loop i want loop till y (variable). Now inside the loop i want to check a condition if x (variable) is equal to any of these Variables a,b,c then print the Value of x.
This code is not working i get Lvalue error with it.
Regards

The = operator is for assignment in C++. You want the == operator to compare equality:

for (x = 0; x <= y; x++)
{
    if (a == x || b == x || c == x)
    {
        printf("Value = %d", x);
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.