Lambdas are a C++ thing, not C.
If 0 and 1 are the only possible values, you can be much much more elegant:
string x = y ? "bar" : "foo";
Else:
string x = (y == 1) ? "bar" : (y == 0) ? "foo" : "";
If 0 and 1 are the only possible values, you can be much much more elegant:
string x = y ? "bar" : "foo";
Else:
string x = (y == 1) ? "bar" : (y == 0) ? "foo" : "";
x = ["foo", "bar"][y]
char *x = (char *[]){"foo", "bar"}[y];