0
votes
0answers
5 views

semicolon and commna in for loops [migrated]

for( i=0, i<3, i=i+1 ) for( i=0; i<4; i++ ) I do not understand why they are same. for( i=0, i<3, i=i+1 ) will start with i=0, then i=0+1=1, i=1+1=2, i=2+1=3, then 3 is not satisfied with ...
1
vote
2answers
166 views

Infinite while loop CPU usage

I'm coding an script in C, which is going to check constantly an array of events, the idea is to check if the Date and time of certain event is equal to de current time and trigger something, i'm ...
0
votes
1answer
106 views

comparison of an unsigned variable to 0

When I execute the following loop : unsigned m; for( m = 10; m >= 0; --m ){ printf("%d\n",m); } the loop doesn't stop at m==0, it keeps executing interminably, so I thought that ...
6
votes
4answers
622 views

Is doing two things on one line always a bad practice?

int *itPins = pins; for(int i = 0; i < count; i++) { ConfigureGpifPinAsGpioOutput(itPins); itPins++; } I have the impression that doing two things in one line is bad practice. This is why ...
0
votes
10answers
951 views

Why does the instruction “do” require a “while”? [closed]

Since this statement is so common: while (true) (Java) or while (1) (C) or sometimes for (;;) Why is there not a single instruction for this? I could think that an instruction that could do it ...