Just having a question that any of the following loop is better or both are same
option 1
for(i=0; i<=3; i++)
{
//Do something
}
option 2
for(i=0; i<4; i++)
{
//Do something
}
Just having a question that any of the following loop is better or both are same
option 1
for(i=0; i<=3; i++)
{
//Do something
}
option 2
for(i=0; i<4; i++)
{
//Do something
}
Those two loops are identical in execution. The second part of the for expression is the comparison to be used to determine continuation of the loop; since you are starting from zero and incrementing by one, these two expressions will always yield the same results.