Page 1 of 1

yet another c tutorial...

Posted: Thu Jul 03, 2008 2:24
by Maz
Index

Why C?

Why C?

Posted: Thu Jul 03, 2008 23:36
by Maz
C is an old language. It is also rather difficult language. It is however pretty straightfowrard. It could be said to be mother of many modern programming languages.

There was a bunch of claims. I now try to back up my sayings a bit.

C was developed ages ago (I do not remember the actual year, but it indeed is old). Yet it has been developed, last change in C standard - which defines what C programming language really is, and what C compilers should provide - was made in 1999. This standardized part of C is called ANSI C (or ISO<insert a few numbers here> standard C), and when you code using only ANSI C features, your code should be compilable with any standards filling compilers. And since a standards filling compilers have been written for almost all widely used operatingsystems, program written with ANSI C should be pretty portable. (unfortunately if you wish to create something else but a console program, you'll need non standardized features).

Difficult. Yes, difficult. C is a low level language. It means that with one C instruction, you do not do any fancy things. Almost all standard C instructions (functions) do just one or a few things, so that you almost always know what happens under the hood. This allows you to write efficient code, since you can strictly only do those things you do need for achieving your goal. If you use some higher level language, you may have nice instructions to do fancy stuff, but you never know all that actually happens when you use the instruction. If I try to generalize my point, I can think of following example. You want to make a coffee. If you do that with C, you need to give instructions to move your eyes, legs and arms so that you accomplish the task. With some higher level language you may have an instruction make_coffee(), which will make the coffee. But point is that with such an instruction you cannot controll how the coffee is coocked. It may well be that cooker walks to the pot using stupid routes. It may be that it cleans the pot, even if it is already cleaned. Even if this instruction was made so cleverly, that it performs some checks for dirtyness of the pot, or uses some advanced algorithm to calculate pot's possible locations it may still be inefficient - You may know that the pot is clean/dirty, and that the pot is on top of the second shelf in the bathroom...

Straightforward... Well, in my previous example, pretty difficult task (cooking coffee) was done with repeating a few basic instructions. It is straightforward - yet challenging.

And finally, many, many languages use 'C like syntax'. For example php, JAVA, python (with some twists though), C++(naturally ;) ) ...

But since it is getting late, I'll leave the opening to be this... Next time I'll write some general things about how computers actually operate. Why? Because if you do not know that, you can never understand C. You may learn how to write some programs, but you'll never know why you write them like you do. And that step is essential in order to utilize the power of C, and more importantly it is essential in order to be creative with C...

yet another c tutorial

Posted: Fri Aug 24, 2018 2:52
by Bryandassy
Are you asking for a tut on how to use it?