Sunday, February 20, 2011

Learn to make proper Input/Output operation in C

             Input/Output operation are very important in C language to  initialize the variable and to put the desired output in C. In every C program there is a use of input/output functions.
          
There are three types of input/output operations :-
  1. Formatted    Input/Output
  2. Character     Input/Output
  3. String           Input/Output 
    Formated input/output function : 
                 


    There are two function printf() and scanf() 

    printf() function:-
    This function is used to display the output to the screen  the  string which is to be printed as it is usually .
    Syntax
    printf("printable string ",argument1,argument2,....,argumentN);
    • printable string  can be any printable character which is written between " ".
    • It can be also be the character of escape sequence starts with (\).the are generally used for moving cursor
    • formats specifier which starts  with % symbol then format specifier are used to print some useful value
    scanf() function:-
    This function is used to take the input value from keyboard or to initialize the variable at  run time of program 
    Syntax
    scanf("printable string ",&argument1,&argument2,....,&argumentN);

    • For scanf(), function "printable string " is  mostly format specifier with % symbol .
    • &argument1,&argument2,....,&argumentN  are the address of the argument variable , initialized value are stored memory ,which has corresponding address of arguments.
    Character Input/Output function : 

    • This type Input/ Output function is used to get one character at a time from the input device such as keyboard and put output of one character on the screen . 
    • getchar and putchar function are used for such operation in C
    getchar() function:-
    syntax
    variable_name= getchar();

    This function is used to accept one character from the keyboard and it should be of C character set, but character may or may not be printable .

    putchar() function:-
    syntax
    putchar(variable_name);

    This function is used to print one character on the screen and it should be of C character set, but character may or may not be printable .

    String  Input/Output function : 

    • The  function is  used to accept the string from the keyboard and print the string to the screen , String  refer to one whole sentence it can be on word also. 
    • this function reads the string till the newline  character is encountered or enter key is pressed.
    • gets() and puts() are string input/output function .

    gets() function:- 
    syntax
    gets(variable_name)
    It accepts the text till the (\n) newline character is encountered or enter key is pressed,Variable must be a array of string.


    puts() function:- 
    syntax
    puts(variable_name)
    This is used to print the string on the screen , it also assign or appends the (\n) newline character at the end of string. 

          Remember

    • Actually puts() and putchar() function can also be execuated by use of a scanf() function. 
    •  string function do not use &  symbol while passing argument .
    • this are all functions of <stdio.h> header file 








      Thursday, February 17, 2011

      Structure of C program


      How to write a simple C program ?

      Hi , friends C is a very easy and important language to learn. A simple C program consist of some main() 
      function , Header files , and body for the program.

      header files

      main function
      {
      variable;
      executable -program;
      }

      Example
      #include<stdio.h> //header files
      #include<conio.h>//header files

      void main() // main function
      {
      clrscr(); // this will clear the screen remove previous programs output
      printf("hello , I am learning C language\n"); /* this command will print “hello , I am learning C language”*/
      getch();// it allows to see output till you press any key
      }


      this program will print "hello , I am learning C language" in output 

      Rules for writing C program
      • every statement in C ends with semi colon.
      • header files should start with “#”.
      • Every main function program should be written in Braces “{}”.





      Tuesday, February 15, 2011

      Features of C Language


       C is a most popular language today because it is well structured with features of high level language and machine. It was designed for special purpose for creating the Unix operating system. 

       Properties of Language

      • C is a programming language which allows to program from top to bottom .
      • C is a procedure oriented programming language .
      • All function in C share global data .
      • C is a powerful, flexible, portable and good structured programming language .
      • C has features of both high level language and elements of assembler.
      • It is suitable for, system programming as well as application.

      Benefits You get using C language
      • C is programming language simple to implement and highly effective .C is middle level programming language provides high level and low level programming support, gives user assemble level programming 
      • C is general purpose structural language, instruction consist of simple expression and common English words like, for, while, break, etc. 
      • C is a compilable language and can run on all machines. It has a rich build-in-function and it has 32 key words. It is extensible continuously adds library functions supported by C library .
      • C has variety of data-type operators and functions in it that makes it highly effective . 
      • It also supports pointers, that access address of variable from computer memory .It also supports dynamic allocation of memory this allows allocating memory at run time and provides modular programming collection of one or more functions or modules. 

      Draw backs of C

      • C language do not supports inheritance. It do not supports the floating in pointers. 
      • Switch statement in C do not provides facilities to use logical operators. 
      • Pointers are difficult to access in this language and only provides one main memory allocation "mallox".


      Sunday, February 13, 2011

      C Programming Language History


      Dennis Ritchie image not found
       Dennis Ritchie








      C is the programming language which was born at AT&T ,s Bell laboratories in USA in year 1972. Language was constructed by Dennis Ritchie. Evolution of C language was done from Language B which was made by Ken Thomson in 1970 , at Bell laboratories . Actually B language was made in reference from the Language BCPL constructed by Martin Richards at Cambridge University in 1967.

                      C language was the most popular language of that time . So due to popularity of the language new version of languages were discovered which were almost same but in compatible, So system developers had to face many problems . So for keeping C language standard in 1983 , American national standard Institute set a committee for making standard for C . Committee approved a version of C in 1989 which is know as ANSI C . It was then approved by ISO in 1990 It is known as C89, Later on new version of C was approved by Standardization committee In 1999 , it is known as C99many old compilers do not support every features of C99.


        Sunday, November 21, 2010

        Data and Information


        Data is a collection of raw facts and figures , It comprises symbols , numbers , words or images. The data may be the result of any experiment or observations of a variable.
        The processed data or manipulated data is called. information
        The process on data means to add some knowledge or manners in the raw facts or in the content of computing to perform some arithmetic or logical operation on it .

        Data compression
        Data compression is a process of encoding applying some specific encoding scheme. Data compression is also used is data transmission.
        Need of compression
        compression is useful because it reduces the consumption of expensive resources like hard disk space or transmission band width.
        • To reduce the storage space
        • To increase the capacity of communication channel
        • Information security
        Large amount of data requires more memory for storage. Data compression is helpful if you want to store data and there is less space on hard-disk  

        Operating System


        Operating system :-An operating system is the software that uses the raw capabilities of hardware and build a platform for execution of program. the operating system manages hardware resources ,provides facilities for accessing those resources and creates higher level ab station like file directories and process.
        Typical computer contains 5 major components:

        1.  Hardware
        2. Operating system
        3. System programs
        4. Application programs
        5. User


        Structure of operating system
        Process Management:-A process is an existing program . Associated with process are its code , its data , a set of resources allocated to it and one or more “flows” of execution through its code.
        Memory management:-At a minimum ,memory must be shared by an application program and operating system .
        File system management:-Computer process information that must be transmitted , processed and stored at a proper location in programming drive .
        Device management:- A computer communicates information with its input and output devices . Processes access those devices with the operating system supervisor .call provided for that purpose

        Types Of Systems Software


        Software are of two types. They are
        • Application software
        • System software
        Application software consists of the programs that perform tasks particular to the machine,s utilization.
        System software act as an interface between the hard ware of computer and the application software that users need to run on the computer.
        Main functions of operating system are as follows:-
        • It recognize input from the key board , send output to the screen ,and keeps the track of files and directories on the disk and also control printer , CD-ROM,etc.
        • It checks whether different program and user running at same time do not interfere with each other
        • It gives the software platform on which the other application software and program can run.

        Compiler is the system software that accepts program written in higher languages and translate them into machine languages.
        Preprocessor is a program that processes its input data to produce output that is used as input to other program such as compiler.