Explanation of for loop

hi every body !

please, can you explain this loop ?

for (Runnable *r = headRunnable; r; r = r->nextRunnable) {


I don't understand how the array is generated.

is *r an array ?

You will need to post the complete program from where you copied that one line

Please follow the advice in Read this before posting a programming question

No, r is quite clearly a pointer.
Presumably, Runnable is a linked list element

for (Runnable *r = headRunnable; r; r = r->nextRunnable) {

this is a common approach for accessing each element in a linked list.

Runnable is presumably a structure that has a pointer to an element of type Runnable. "r" is set to presumably the first element of the list, "headRunnable". the loop continues at long as "r" is not NULL. It iterates by setting "r" to the next element on the list using the pointer in the structure, "r->nextRunnable".

this expects that pointer, "nextRunnable" in the last element on the list to be set to NULL. Additional elements could be added to the list either at the end or in the middle of the list.

the for loop stops when it sets "r" to a NULL from that last element in the list

The middle expression in a 'for' loop is a boolean (true or false) expression. The integer value 0 is 'false' and any other integer value is 'true'. The boolean expression "r" is therefore equivalent to "r != 0" and, since 'r' is a pointer and a pointer with a value of 0 is the NULL pointer, is also equivalent to "r != NULL".