I think your program has undefined behavior:
int main(int argc, char *argv[])
{
int c = 'z';
c = getc(stdin);
if (c == EOF)
printf("EOF!\n");
else
printf("got '%c' (0x%x)\n", c, c);
return 0;
}
The first c should probably use %d, not %c, since c is an int. Maybe something like:
printf("got '%d' (0x%x)\n", c, c);
Use g++ -Wall or a Sanitizer to vet the code at compile time.