This is Words and Buttons Online — a collection of interactive #tutorials, #demos, and #quizzes about #mathematics, #algorithms and #programming.

So you think you know C?

A lot of programmers claim they know C. Well, it has the most famous syntax, it has been there for 44 years, and it’s not cluttered with obscure features. It’s easy!

I mean, it’s easy to claim that you know C. You probably learned it in college or on the go, you probably had some experience with it, you probably think that you know it through and through because there’s not much to know. Well, there is. C is not that simple.

If you think it is — take this test. It only has 5 questions. Every question is basically the same: what the return value would be? And each question has a choice of four answers, of which one and only one is right.

1

struct S {
  int i;
  char c;
} s;

int main(void) {
  return sizeof(*(&s));
}
	




2

int main(void) {
  char a = 0;
  short int b = 0;
  return sizeof(b) == sizeof(a+b);
}
	




3

int main(void) {
  char a = ' ' * 13;
  return a;
}
	




4

int main(void) {
  int i = 16;
  return (((((i >= i) << i) >> i) <= i));
}
	




5

int main(void) {
  int i = 0;
  return i++ + ++i;
}
	




That's it.

To unscreen the right answers and to see your score, press the button below.