[Ilugc] Learning C coding

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Tue, 26 Jun 2012 15:48:08 +0530

All my life I have benefited by C coding skills.

I first learnt C when I was in college but I did not learn properly.

I was not from computer science department and I was not a good student
 in certain ways.

In many other ways I was a good student.

Anyway C programming is something I started to focus much later.

Today I realize that without that I would not have been able to make a living.

How to start learning C?

How long does it take?

C coding requires knowledge of pointers, structures, callback
functions and so on.

Some concepts take time to learn as they are new concepts.

Not really programming.

However analytical ability , mathematical thinking which is
fundamental to programming
 apply to C too.

You have to know how systems programs are written.

And some style guidelines are also good to follow.

Like indenting loops and if conditions, forming comment boxes like this:

/***********************************
 *
 ***********************************/

It is very important to learn the
system() system call since it does a fork() and exec() to execute
shell programs.

For example.

$ cat f.c
#include <stdio.h>
int
main() {
   system("date");
}

$ make f

$ ./f

will print the date.

It is a great idea though it is slow and you should actually be using
strftime(), gettimeofday() or time() or some
 such thing.

But sometimes using system() is allowed.

Also you can learn some IPC mechanisms like shmget(), shmat() and signals.

And of course sockets programming.

I will write about those later.

Then it took me some good 6 more years to become comfortable.

Even today I would not claim to be a very good c programmer.

It also requires memory power as is the case with UNIX and perl in general.

-Girish

-- 
Gayatri Hitech
http://gayatri-hitech.com

Other related posts: