воскресенье, 30 мая 2010 г.

Week 3 in OOP344

Lazy evaluation
Assume we have an array with 10 elements
and we want to print only those are greater than 3
so
int arr[10] = {1,2,3,4,5,2,7,2,5,9};
for(int i = 0; i < 10; i++){
arr[i]>3 && printf("%d \n", a[i]); /* the second part of the condition is evaluated only when the first one is true */
}

понедельник, 17 мая 2010 г.

I've just created my first blog)))))