Why not try 2 solutions?
#include <stdio.h>
#include <time.h>
#define LOOPS 1000000000
void main(void)
{
clock_t start1, start2, end1, end2;
int x=1,i;
start1=clock();
for(i=0;i<LOOPS;i++)
{
if (x==0)
{
x=1;
}
}
end1=clock();
start2=clock();
for(i=0;i<LOOPS;i++)
{
if (0==x)
{
x=1;
}
}
end2=clock();
printf("x==0 %d ns\n", end1-start1);
printf("0==x %d ns\n", end2-start2);
}
source
share