#include <stdio.h>
unsigned long press_events[] = {1, 2, 3 ,4};
void print_event_queue() {
char buff[256], *pos = buff;
for(int i = 0; i < 127; i++) {
if(press_events[i]) {
pos
+= sprintf(pos
, " %lu", press_events
[i
]); }
}
}
int main(void) {
print_event_queue();
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CnVuc2lnbmVkIGxvbmcgcHJlc3NfZXZlbnRzW10gPSB7MSwgMiwgMyAsNH07Cgp2b2lkIHByaW50X2V2ZW50X3F1ZXVlKCkgewogICAgIGNoYXIgYnVmZlsyNTZdLCAqcG9zID0gYnVmZjsKICAgICBmb3IoaW50IGkgPSAwOyBpIDwgMTI3OyBpKyspIHsKICAgICAgICAgaWYocHJlc3NfZXZlbnRzW2ldKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICBwb3MgKz0gc3ByaW50Zihwb3MsICIgJWx1IiwgcHJlc3NfZXZlbnRzW2ldKTsKICAgICAgICAgfQogICAgIH0KICAgICBwcmludGYoIiVzIiwgYnVmZik7CiB9CgoKaW50IG1haW4odm9pZCkgewoJcHJpbnRfZXZlbnRfcXVldWUoKTsKCXJldHVybiAwOwp9