Skip to content

Instantly share code, notes, and snippets.

@yoichi
Created December 17, 2014 04:00
Show Gist options
  • Save yoichi/3e891274b6c1e23b9f00 to your computer and use it in GitHub Desktop.
Save yoichi/3e891274b6c1e23b9f00 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
if (int x = 0) {
printf("true: %d\n", x);
//printf("true: %d, ?: %d\n", x, y); // ‘y’ was not declared in this scope
} else if (int y = 0) {
printf("false: %d, true: %d\n", x, y);
} else {
printf("false: %d, false: %d\n", x, y);
}
}
// output: false: 0, false: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment