#include void set_x(int *x) { char c = getchar(); if (c == '1') *x = 0; } int main() { int x; set_x(&x); int a[] = {1, 2, 3}; printf("%d\n", a[x]); return 0; }