July 30, 2010

Weird C or is it?

Share on Facebook

I guess I am one of the leftover dino from Mainframe and UNIX/C era. While I am enchanted by the progress programming in general has made with .NET, Java, frameworks and Web technologies, I cant help but feel that there is a need to understand the fundamentals very well. I am in no way say that “we” C programmers are better than Java and .NET, in fact, I am amazed at the spread of technology footprint that modern developers have to understand and remember. However, some of the developers look down upon C and C++ as outdated (which they may be soon), but miss the point… Fundamentals have to be strong and C/C++ kind of bring you closer to metal to make one realize that.
Check out the code fragment and explain why it works (I don't mean syntactically). It is based on some very sound principles of programming (at least in C/++), even though it looks completely useless (which it is) and syntactically incorrect (which is it not)
#include <stdio.h>

int main()
1; 2; 3; 4; 5;
6, 7, 8, 9, 0;

return 0;

Trust me, if you can explain the working behind this code snippet, you would understand a lot about statements and expressions in C/C++. Leave your explanation in comments.

No comments:

Post a Comment