Pages

START PROGRAMMING IN LANGUAGE


START PROGRAMMING  IN  LANGUAGE


As we  has already discussed we can use various approaches to develop software .Today language are based on two main concepts Procedural Programing.C Language is Procedural language and C++ ,Java  are and Object Oriented Programming  Language .In procedural language fuctions are created to perfirm various tasks.C Language is a  procedural language where every thing is done in the form of functions .In C language we have two main types of functions:

1 Inbuilt function
2 User defined function

Inbuilt function are pre defined function in the C compiler and we can use them according to the requirement work of inbuilt functions is fix. C  Language can contain any number of user define functions . But one of them must be main function.Main function is the entry point of the program, compiler starts the execution of program from function .

Explanation of Basic structure of C

Header file :header files contain all the library functions and macros.Header files have “.h” extension  .for example ‘stdio.h’  header file contains inbuilt function printf (),scanf() etc. In   C there are 24 header files

Preprocessor Directive:

It instructs the C  compiler to add contents of a file into the current program during compilation .

#include <stdio.h>

Global   Variable Declaration
                                                There are some variables whichs are required in different functions.it is better to declare such variables outside of all the functions.These variables are Called global variables.



#include <stdio.h>





                                      # include<conio.h>
                     void main ()                         
                                                                 {

                                                                  Int  a, b, c;
                   a = 10; b= 20;
                                                                   c=a+b;
                printf(“the result is  %d”,c);
                    getch ();
                                                                     }

       Function Defination : 

This  section contains all user defined fuction  These user defined function are always called in the main function.

                                                                void  main  ()

0 comments: