Welcome to Adarsh's World of Programming

I certainly believe that, there are only two categories of people on earth. The first category of people are known as ordinary people. The second category of people are known as Programmers. Though, I always aimed to become an actor, I somehow became a programmer. What's done is done. Till the time, I don't get a big break in Bollywood, let me continue in this profession.

I certainly believe that, I am not a good programmer. But some of my friends who knew my programming skills insisted that I write a book on C. I just asked them to shut up. I am not some great guy like Yeshwant Kanetkar to write a book. Some three years back, I had a subject in college called Numerical Methods and C programming. That was my first encounter with C and I really hated it. It was only after I went through Yeshwant Kanetkar's "Let Us C", that triggered an interest in me. Its probably the only book on earth which I have read from start to end, atleast a dozen times. I read Kanatkar's book before I read ANSI C by Kernigan & Ritchie. I later referred to many C books by great authors, but none were as interesting and absorbing as Kanetkar. What's more important is the language and the presentation skills, rather than merely explanation of concepts. Its better to explain a concept in just five quality words rather than talking all nonsense for 25 pages. With this idea in mind, I just started to write my own notes in C. In about 18 months time, I am surprised to see that it has grown over 400 pages. I think, I must start contacting publishing houses!!!  I still believe that I am an amateur C programmer. Last year somebody told me about Brainbench Certifications. I just thought to give it a try. The questions were tricky and I didn't really expect to pass. By stroke of luck, I did pass. But what surprised me the most was my score. It showed a score of 4.76 out of 5. I think these Brainbench people have gone bananas !!!. I wish we had some international C certification tests like that of Java, Oracle and Networking. Unfortunately, there is none. 

All, I can say is that, over a period of two years, I have certainly developed a unique style of programming. I write codes that are easy to understand at a glance. My choice of variables is totally non-conventional. I don't sacrifice simplicity even for standard notations. For eg. I would never choose conventional variables like lpszArgs or hWnd usually used as standard variables for denoting command line arguments and handle to a window respectively . Simple variables like cmdlineargs and  windowhandle could better do a job. Too much of commenting is also bad. It looks stupid to see comments like "This is an integer variable".  Only key comments normally suffice for any programmer studying my programming codes. On an average, the ratio of code to comment should be around 10:1. 
# Programming Tip !!!
Whenever you want to perform a comparison for equality of a variable with a constant in an IF or a WHILE statement, always try to keep the constant expression on the left hand side. 

  Eg. Instead of if (a==5)  use  if ( 5==a) . 
           Instead of if (a&&b==0) use if(0==a&&b)
           Instead of while(x==7) use while (7==x)
           Instead of if(filehandle==INVALID_HANDLE_VALUE) use  if(INVALID_HANDLE_VALUE==filehandle)

By using the constant on the left hand side, in case you make a mistake by putting a single = instead of double, you can easily detect the error, as the compiler will complain and give a syntax error that you are trying to modify a constant. Thus if(a=5) is syntactically correct and will not display error while if(5=a) is syntactically wrong and would display an error.
Though this tip is well known hardly anyone uses it, including myself. The reason is that we are all over confident that we simply cannot forget the double== . Nevertheless, good programming practice never hurts.
Unfortunately I do not have a softcopy of all my programs. And I don't have time to sit and type all the code. I cannot give it for DTP as the non technical typist might mess up all the semicolons and brackets and I may have to spend more time on correcting the typos than typing it myself. Nevertheless, I have included some of the codes which I have written. However, this is not the end. As and when I get time, I would keep on adding new programs to it. The programs that I have included are of elementary level and may not be interest to advanced programmers. I declare that, these programs are written by me and are syntactically and programmatically correct to the best of my knowledge and belief. I have compiled and run all the programs myself and cut and paste the code after it gave the correct output. So there is no way of errors creeping in. However, I have compiled all programs on a VC++ 6.0 compiler. Some of the programs might need some variations on Turbo C and other compilers. I am sorry, but I don't have Turbo C in my system to cross verify.

C is like an abyss. Nobody knows how deep it is. Different people view it differently. An embedded systems engineer, an applications developer and a database programmer, all see it differently. An embedded guy may see C as good interface to access BIOS routines. An application developer may be concerned only with variety of inbuilt functions that C has to offer while a database programmer might be interested in data structures through C. The common thing about them is that, they just cannot imagine life without C. Infact I was thinking of writing a horror novel by that title. Unix is defined as an operating system of experts, by experts and for experts. The entire Unix operating system was written in C. The earlier versions of Oracle were completely written in C. The good old Socket programming using C is still the most efficient and straightforward method of implementing communication between two or more applications and their components, though it cannot handle complex data types due to usage of low level system APIs.

C as a insurmountable language. There are many applications possible in C beyond my imagination. I am basically a Windows programmer and I view C as the easiest and most flexible language for programming Windows applications. In case, at this moment of time, Visual Basic struck your mind, please concentrate on the word 'flexible'. Honestly, I do not think that VB guys are serious programmers. Quick and dirty work is never my style. Unfortunately, most software projects have impossible deadlines and require just a neat and good looking user interface to access a backend application. In such a situation VB is the best choice. This is the only reason for the popularity of Visual Basic over Visual C.

I have divided my programs into three broad categories

1. Simple C programs, that could be run on any C compiler

View Programs


2. Win32 Console applications that might require a VC++ 4.0 or higher compiler

View Programs


3. Win32 Applications that might require VC++ 4.0 or higher compiler .

View Programs



C ++


Visual Basic





Go to Top,  C,   C++,  Java,  VB,   ASP


Active Server Pages