C Pitfalls – Test yourself (what will be printed)

C is a great programming language , very fast , almost low level but its because the responsibility to write a good working code (and secure) is the developer.

Array access , type casts, function parameters and more are not checked by the runtime so if you do something wrong – you crash

It is important for any C developer to be familiar with some pitfalls. Let see some , try to think what will be printed and check the answers bellow

Note: There is no compilation errors in all the following pitfalls

Pitfall 1

Check Answer

Pitfall 2

Check Answer

Pitfall 3

Check Answer

Pitfall 4

Check Answer

Pitfall 5

Check Answer

Pitfall 6

Check Answer

Pitfall 7

Check Answer

who got 7/7 ?

 

Tagged ,

2 thoughts on “C Pitfalls – Test yourself (what will be printed)

  1. Devlish – but great fun to solve.

  2. Yes, I did 7/7… Use vim, it has both syntax coloring and vi compatibility, and it runs on Linux and Windows, and is useful to know when you work with a bare-bones Linux

Leave a Reply

Your email address will not be published. Required fields are marked *