C Language Complete Introduction
As most people
know, C in terms of computer years is ANCIENT. I want to make it known
however that this in no way affects what it is capable of doing, C is still
just as useful and powerful as it was when it was first created.
How one language changed the world
C language Complete introduction |
Prior to C, there really wasn't a great way of
getting anything done, you typically just wrote assembly that would run
directly on the chipset you were using. This meant that if you wanted to
migrate a program to a machine running a different chipset, you would have to
do a re-write (and we complain about having to change a couple lines of css for
each browser?). Obviously this wasn't too great, but on top of that writing
assembly is just...well, tedious. Prior to C, a language called B was being
developed, and so C started as an iteration of B, and it was used to write a
version of the UNIX operating system. C was developed by Dennis Ritchie between
1969 and 1973 at Bell Labs (Yep, AT&T;) with really one objective, and that
was to lift you up one level from the underlying assembly so
as to abstract the chipset specific assembly away from you so you could run a
program on many different chipsets with realtively little work. This sparked a
revolution in how people thought about computing and programming in general. It
had such an immense impact on the world that we are still using things written
in C, for example, most operating systems, games, browsers, databases, web
services, a fair bit of API's and many more things are written in C.
Why C?
C has one primary reason for being used:
Speed
C is one of the fastest languages out there, given
a program written in say C# or Java, and the same program written in C, C will
usually outperform the Java/C# program by several times the efficiency,
sometimes up to hundreds of times more. Obviously there are places where this
speed is not needed, a business app for an accounting department isn't
performance critical, it's data integrity is extremely important however, and
so developers will often opt to use a language like C# that handles data fairly
well for you when it comes to a business app. C also isn't really ideal for web
sites, that's not to say you can't do it, it's just...well, you know what, go
give it a try and you'll see what I mean.
What would I ever use C for?
well...if
i'm being honest? in a professional career you may never ever write a single
line of c. This again is because of
the nature of business, a corporation doesn't really care if their companies’ insurance claims application is running a little
slow, as long as the data is preserved and it does the job. That doesn't mean
you would never use it though, one thing C is really good for is writing small
tools or libraries. As an example, I may want a thing that will organize my
files in a specific way, rather than go through every single file directory and
doing that myself, C is a great language to write a tool to do this for me.
Other things it may be good for? Think about something that speed matters on,
if you ever want to write a game, write it in C. I know popular belief nowadays
is to write in JavaScript or HTML5 or Java or Unity, DONT, I won't go off on
that tangent but...maybe I will add a section on here as to why you should
write games with C. A web service is very perfomance critical, C would be good
for this, I mean I could go on and on but frankly there's just a lot of stuff
and I don't have the time to cover it all.
C is hard though
I hear this WAY too often , some guy who
writes html and css only told a person that C is a difficult language
because...gulp...you have to manage your own memory -GASP-. Okay, let me break
this down for everyone. C has less than 64 total
key words, and it only has that many because of the C99 standard, prior
to that it only had 32 keywords, and you can still write pre-C99 C code.
compare that to something like C# that has 85 keywords for the language alone,
that's not including the fact that you need to learn how to use Visual Studio,
use each framework to do certain things, learn the .NET framework (which is
MASSIVE), etc. That's not to say C doesn't have frameworks, but most aren't
needed to do useful stuff, except maybe Win32 for Windows, and you can type C
into a text editor and run it through a compiler without a whole IDE over your
head (yes, C# can do this but it's not something you would ever do so to argue
that would be pointless). The point is, aside from pointers, C is one of the
easiest languages I've ever written in, if you covered just one keyword a day
you would learn almost all of C in a mere 2 months (it will be much quicker
than that, I promise.) So, sit back, relax, take a breather, and get excited my
friends, because by the end of the first few lessons you'll see just how easy C
really is!
C will help you transition to any other language
We'll talk more on this, but C is a functional
language, that means it does not use object orientation at all, this cuts down
massively the amount of learning that goes into it. Another thing, most
languages are written in...can you guess...? C! Therefore, almost all syntax
can be directly linked back to C, so the way you write an if statement in C is
identical to C++/Java/C#/JavaScript/etc. C has one truely unique attribute
though that will be extremely valuable to you, and you probably don't even
realize it yet, and that is the ability to see what your code is doing. More
seasoned programmers may be thinking to themselves that other languages let you
see what's going on and you're right...to some extent. In C however, you
literally can see the exact assembly that is running, the data being stored in
each memory register, how your memory is being allocated for each piece of
data, how to OS does certain tasks, and the list goes on and on and on of what
you can see in C that almost no other language can offer. This to me is the
greatest value in learning C, if you understand in a deep way what is happening
on your actual processor, not just what you think the Java Byte-Code MIGHT be
doing, you are light years ahead of most programmers, and that is a fact. I
sincerely hope that I am able to show you all the power of this amazing
language, and I hope you too will be excited to write C code on your own.
Comments
Post a Comment