Is there any difference between these two in terms of efficiency? Is the second more optimized? I compiled the first code, and then I decompiled it, resulting second code.
for (i = 0; i < n; ++i) {
if (a[i] == x) {
printf("%d", a[i]);
return 0;
}
}
return 1;
i = 0;
while (1) {
if (n <= i)
return 1;
if (a[i] == x)
break;
i = i + 1;
}
printf("%d", a[i]);
return 0;