Showing posts with label C language. Show all posts
Showing posts with label C language. Show all posts

Monday, February 7, 2011

C Programming - Part 4

Working with C Operators 

There are some basic but important things that every learner of C should know . 
These are--             
• Add plenty of comments using  (/*     */    or     // )
• Good layout,
  it should be not like this :
      main( ) {printf("Hello World\n");}
• Use meaningful variable names
• Initialize your variables
• Use parentheses to avoid confusion as:
      a=(10.0 + 2.0) * (5.0 - 6.0) / 2.0

C Programming - Part 3

Structure of a ‘C’ program
This is the structure of program which shows how it looks like.

      pre-processor directives
      global declarations
      function prototypes
      main( )
      {
      local variables to function main ;
      statements associated with function main ;
      }
      f1( )
      {
      local variables to function f1 ;
      statements associated with function f1 ;
      }
      f2( )
      {
      local variables to function f2 ;
      statements associated with function f2 ;
      }


Structure of my first ‘C’ program

   /* This is
      a comment */
   // This is a one-line comment


   # include <stdio.h>     /* includes header files */
  int  main( )     /* Must have a main function. First function executed */
   {
   printf ("Hello World!");      /* stdio functions */
   }



After making this program we need to compile it.One of the compiler we are using is gcc compiler . gcc compiler is best compiler for C programs.The full form of gcc is GNU Compiler Collection .

Saturday, February 5, 2011

C Programming - Part 2

In addition to surender's Last article, I would like to elaborate more on the C Language. Most of the operating systems, which you might have been using in your desktop, servers, mobile phone, mobile TV, portable MP3 players etc. are running the C code.  "Kernel" the integral part of the operating system,  and it is designed and developed using C programming algorithms. If a person is well versed in C, he/she can do any thing in computer science.

I really appreciate Surender's initiative to teach C Language through this blog. If any of his "student" have any doubt then please don't hesitate putting up your questions.

Wishing you all a very successful C Programming.

Friday, February 4, 2011

C Programming - 1

Part 1"C is Basic language for learning if you know the C language then you can learn any language but professional C is not in 10 programs . add, mul div, fact programs . C means logical programming or conceptual language .That means you should have clear concept of C i.e. deep knowledge then you will be able to adjust C and in turn any language ,very easily .Also you have to learn the programming concept of C but that does not mean just 10 programs .So we will try to learn more than   
so called 10 programs. But before Starting the C language we will check out intro that what is C ? Who has developed the C language ? Who created this ? How it is with us  ?"



The programming language C was originally developed by Dennis Ritchie of Bell Laboratories and was designed to run on a PDP-11 with a UNIX operating system.
Although it was originally intended to run under UNIX, there has been a great interest in running it under the MS-DOS operating system on the IBM PC and compatibles. It is an excellent language for this environment because of the simplicity of expression, the compactness of the code, and the wide range of applicability. Also, due to the simplicity and ease of writing a C compiler, it is usually the first high level language available on any new computer, including microcomputers, minicomputers, and mainframes.
C is not the best beginning language because it is somewhat cryptic in nature. It allows the programmer a wide range of operations from high level down to a very low level, approaching the level of assembly language. There seems to be no limit to the flexibility available. One experienced C programmer made the statement, "You can program anything in C", and the statement is well supported by my own experience with the language. Along with the resulting freedom however, you take on a great deal of responsibility because it is very easy to write a program that destroys itself due to the silly little errors that a good Pascal compiler will flag and call a fatal error. In C, you are very much on your own as you will soon find.

Wait for next article on starting programming concept with good skills in deep.This is just the intro part of C.

Thanks
Er.Surender Sharma
linux Kernel Developer