Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sharda University P. K. Mishra (Asst.Prof) Department of Computer Science & Technology Subject Name: Programming Using C Sub Code: CSE-106 Programming.

Similar presentations


Presentation on theme: "Sharda University P. K. Mishra (Asst.Prof) Department of Computer Science & Technology Subject Name: Programming Using C Sub Code: CSE-106 Programming."— Presentation transcript:

1 Sharda University P. K. Mishra (Asst.Prof) Department of Computer Science & Technology Subject Name: Programming Using C Sub Code: CSE-106 Programming Using C1

2 C is a popular general purpose programming Language. It is designed and developed by Dinnish Ritcie at Bell Laboratories in 1972. This language is Associated closely with Unix operating System. 2Programming Using C

3 C Runs under a number of operating System including MS.DOS. C Program are Fast, Efficient and Highly portable. 3Programming Using C

4 C Language is a middle level language. It combines the features of high level language and functionality like Assembly language. It reduces the Gap between high level and Low level language that is why it is known as middle level Language. 4Programming Using C

5 C is a Structural language. A Structured language allows variety of programs in small modules. It is easy for Debugging, Testing and Maintenance if a Language is a structured one. Structured Language are easier and most of the developers prefer these languages than the non structured ones like Basic and Cobol. 5Programming Using C

6 Program: A Program is a set of Instructions for performing a particular task.A Program can be written in assembly Languages as well as high level language. This written program is called as source program. The source program is to be converted to the machine language, which is called as object program 6Programming Using C

7 Interpreter: An interpreter reads only one line of source program at a time and converts it to object codes. In case of any errors the same will be indicated instantly. The disadvantage is that it consumes more time for converting a source program to an object program. 7Programming Using C

8 Compiler: A Compiler reads the entire program and converts it to the object code. It provides errors not of one line but errors of entire program. Only errors free programs are executed. It consume little time for converting a source program to an object program. When the program length for any application is large compilers are preferred. 8Programming Using C

9 Structure of a C Program: Every c program contains a number of several building blocks known as function. Each function of it performs task independently. A function is subroutine that may consist of one or more statements. 9Programming Using C

10 /* Comments*/ //comments #include main() { Declaration part Executable Part } User-defined function { } 10Programming Using C

11 Header File Section: C program depends upon some header files for function definition that are used in program. Each header file by default is extended with.h.The file should be include using # include directive Ex #include Or #include “ stdio.h” In this example file is included.i.e all the definition and prototypes of function defined in this file are available in the current program. 11Programming Using C

12 Global Declaration:- This section declares some variables that are used in more then one function. These variables are known as global variables. 12Programming Using C

13 Function Main (): Every program written in c language must contain main () function. Empty parentheses after main are necessary. The function main () is the starting point of every C program. The execution of the program always begins with the function main (). Except the main () function other section may not be necessary. The program execution starts with opening brace ({) and ends with the closing brace (}). Between these two braces the program should declare the declaration and the executable part. 13Programming Using C

14 Declaration Part: The declaration parts declare the entire variables that are used in executable part. The initializations of variables are also done in this section. The initialization means providing initial value to the variable. 14Programming Using C

15 Executable Part : This part contains the statements following the declaration of the variables. This part contains a set of statements or a single statements. These statements are enclosed between the braces. 15Programming Using C

16 Programming Rules: All statements should be written in lower case letters. Upper case letters are only used for symbolic constants. Blank spaces may be inserted between the words. This improves the readability of the statements, however it is not used while declaring a variable, keyword, constant and function. It is not necessary to fix the position of the statements in the program. i.e the programmer can write the statements any where between two braces following the declaration part. The user can also write one or more statements in one line separating them with a semicolon (;). Hence it is often called a free from language. The opening & closing braces should be balanced. 16Programming Using C

17 Thanks 17Programming Using C


Download ppt "Sharda University P. K. Mishra (Asst.Prof) Department of Computer Science & Technology Subject Name: Programming Using C Sub Code: CSE-106 Programming."

Similar presentations


Ads by Google