Your question is Embedded C Output Behavior. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
During an ALTEN México embedded systems interview you're handed this small C program running on a test bench.
#include <stdio.h>
int compute(int a, int b) {
int result = a++ + ++b;
return result;
}
void print_values(int arr[], int n) {
for (int i = 0; i < n; i++) {
printf("%d ", arr[i]);
}
printf("
");
}
int main() {
int x = 5, y = 10;
int r = compute(x, y);
int values[3];
int j = 0;
for (int i = 0; i < 3; i++) {
values[j] = i * 2;
j++;
}
printf("r = %d
", r);
printf("x = %d, y = %d
", x, y);
print_values(values, 3);
return 0;
}
Describe exactly what this program does and what it prints to the console.