Never underestimate the power of Passion!

Friday 25 April 2014

On 23:11 by Vardan Kumar in    No comments
Getting Started With C
Let us begin with a brief introduction of C.  C is a middle level language that was originally developed by Dennis Ritchie for the Unix operating system. It was first implemented on the Digital Equipment Corporation PDP-11 computer in 1972. It is a middle level language because via C one can develop both system software and application software.
All the application of Unix operating system are virtually written on C language.

Main features of C language.

  • C follows the Modular programming approach i.e it provides a software design technique to which software is composed of separate parts.
  • C programs are Portable i.e they can run on any compiler with a little of no modification.
  • C provide wide variety of Data types.
  • C provides Bit manipulation i.e we can manage various operation on bit level or we can manage memory on bit level.
  • C supports efficient use of pointers.
The only way to learn a new programming language is by writing programs in it.
Let us start with a program...
       Print the words
         Cspassion - never under estimate the power of passion
It is a hurdle so to leap over it you have to write program text, compile it and run it.
In C the program to print the above text is.
#include <stdio.h>
 main()
 {
       printf("Cspassion-never under estimate the power of passion");
 }
This running process vary from system to system i.e if you are using UNIX operating system you must create a program in a file whose name ends with extension ".c" ex. cspassion.c, then compile it with command
       cc cspassion.c
if you haven't botched anything, such as omitting a character or misspelling something, the compilation will complete silently and it makes a executable file named, cspassion.out
if you run a.out by typing the command
      cspassion.out
it will print
       Cspassion-never underestimate the power of passion!
The output screen will be like this
C Programming
First C Program
          
 A C program always consists of functions and variables. A function contains statements that specifies the computing operation to be done and variables stores values stored during computation.

Explanation of above program

  1. #include<stdio.h>:- This line tells the compiler to include the information about standard input/output libraries. This line always appear at the beginning of C source file.
  2. main():-This defines a function named main that receives no argument values. program always begins executing at the beginning of main. Main usually call other functions to help perform its job, some that you wrote.
  3. }:- These are braces. statements of main function are enclosed in braces.
  4. printf("cspassion- never under estimate the power of passion!"); :-As the function is always called by naming it, followed by parenthesized list of arguments. here printf is a function with s a list of arguments in the form of character strings.

Note:-

  • printf never supplies a new line automatically.
  •  \n is used in C notation for newline character.
  • among other C also provides \t for tab, \b for backspace, \" for double quote, \\ for  backslash itself.

Viva Questions???

  1. Who developed the C language And in which year?    (Dennis Ritchie in 1972 ).
  2. Why C is a middle level language?    (because via C one can make both system software and application software?

Let me ask you some questions?    

  1. As main function calls other function and we also know that main is also a function then tell me main is called by_____?
  2. printf("cspassion
          ");
           Will the compiler accept this format?


By:Hardik Thakral
                   
                                                                       

0 comments:

Post a Comment