User Profile
Collapse
-
it is an interview question.I would like to know the answer. -
comparison code in C
Consider the following code:
int CheckForZero (int a[], int n)
{
int i;
for (i = 0; i < n; i++) {
if (a[i] == 0) {
return (TRUE);
}
}
return (FALSE);
}
This code works - but it does a check for every element in 'a' - i.e.
it does "n" compares and bails early if it finds even one zero element. ...
No activity results to display
Show More
Leave a comment: