MathJax

Friday, December 20, 2013

Programming Language of the Week: C

C is a compiled language. Rather than having a separate program interpret your code line by line, a compiler reads your entire program at once and changes your human-friendly source code into binary code that is directly executed your processor (e.g. an *.exe file on a Windows system). If you know how to interpret binary instructions for your processor, you can trace out which instructions will be loaded into your processor in order.

C of course isn't alone in being a compiled language, but it is perhaps the most prolific. C has been used extensively in the development of Windows, OS X, and the Linux kernel. It's the go-to for systems which have requirements which preclude the overhead of interpreting code line-by-line or pauses for garbage collection. Interpreters for interpreted languages are often written in C.

Learning C gets you "close to the metal." Understanding pointers and being responsible for your own memory management illuminates the barrier between the logical systems we aspire to create and the physical machines which realize those designs.

You can see C's linguistic influence in later languages by noting several features shared by other languages: statement blocks grouped by opening and closing {}s, primitive variable type names int/long/char, for-loop syntax, pre-/post- increment/decrement operators, the same boolean operators are shared in whole or in part by Java, JavaScript, C# and more.

To learn C, you'll need a C compiler, a motivating project, and a good tutorial. Check out http://www.cprogramming.com/tutorial/c-tutorial.html for more.


#include <stdio.h>

int main()
{
    printf("Hello, world!");
    return 0;
}

No comments:

Post a Comment