📜 ⬆️ ⬇️

Do you think you know C?

image

Many programmers claim that they know S. Well, he has the most famous syntax, it has existed for 44 years and it is not littered with incomprehensible functions. He is simple!

I mean, just to say that you know C. Probably you studied it at the institute or along the way, most likely you have some experience in using it, you probably think you know it far and wide, because there is not much you need to know. Actually a lot. With not so simple.

If you think that it is simple - pass this test. There are only 5 questions in it. Each question is basically the same: what will be the return value?

Publishing support - Edison company, which develops electronic archives and document management systems , as well as integrates software and hard for industrial enterprises .
')
In each question there are 4 possible answers, of which one and only one is correct.

one


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

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

. 4
. 5
. 8
D.

2


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

. 0
. 1
. 2
D.

3


main(){
  char a = ‘ ‘ * 13;
  return a;
}

. 416
. 160
. -96
D.

4


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

. 0
. 1
. 16
D.

5



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

. 1
. 2
. 3
D.

, .



image
. , .


, « ».

.

. C RAM , . 5 , 8. 16. 6. . GCC aligned packed , . C « ».

integer promotion. , short int , short int . . int. - . , .

, , . short int int , . . « ».

. , integer char . , . , char . 6 ( ?) 32 . , « ».

, , , , , int . 16 , . , , .

« ».

— . + , i++ ++i , . . . . , « ».

image
, .

. , . - .

, 1998 15 , . , ++ .

2013 , PLC. , . , , . .

; , , « » , — . , - WAT .

, - , 15 , 15 .

:


,

Source: https://habr.com/ru/post/315016/


All Articles