Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction. Natural Languages are languages of the Humans These Languages tend to be ambiguous A sentence in natural may not have just one meaning I.

Similar presentations


Presentation on theme: "Introduction. Natural Languages are languages of the Humans These Languages tend to be ambiguous A sentence in natural may not have just one meaning I."— Presentation transcript:

1 Introduction

2 Natural Languages are languages of the Humans These Languages tend to be ambiguous A sentence in natural may not have just one meaning I will not be coming tomorrow I will not come tomorrow I shall not come tomorrow

3  Programming Languages are the languages of the Computers  Computers need clear and precise instructions  Computers unlike human beings do not have the ability to judge and decide the correct meaning  Programming language is needed to give clear and precise instructions to a computer  It consists of set of predefined rules called syntax of the language

4  Grammar – Syntax  Compiler - Translator

5 Analogy  I speak only English  My friend speaks both English & French  And, the Crepe Seller under the Eiffel Tower is bound to speak only French  You really do not want to know how we communicate!!! A Trip to France

6 Translator Compiler  Example Computers understand only machine language,which is similar to binary language It is made up of only 0 and 1 Now that sounds vague, doesn’t it? And we write our programs in English like language or the programming language The translator which translates programming language into a machine language is known as compiler Programming Language 1 Programming Language 2 Programming Language 3 Translator Compiler Computer machine language

7 Program  Example /* my first C program #include main( ) { print (“hello c”); return; } output : hello C A program can be defined as finite set of precise and clear instruction given to a computer for performing task The process of writing these step by step instructions using a chosen language is known as programming

8 In & Out  Inputs  Water  Ice  Lemon  Sugar  Output  A Refreshing Lemonade A program may take zero or more inputs A program may produce one or more outputs

9 Basics  Example /* my first C program #include main( ) { print (“hello c”); return; } output : hello C Program must end after finite number of steps The instructions in a program must be very clear All the instructions must be effective, i.e. they should be carried out exactly A program may take zero or more inputs A program may produce one or more outputs

10

11  Nothing really!!  But we do require names to separate one from another  A Name, in fact identifies each one of us and is our identifier – really!!!!

12 Identifier in C CostVariable Main( )Function FINESymbolic constant IntPredefined word A word that a user form by making use of character set is known as identifier It consists of letters,digits and some special characters

13

14  How many times have you got into a tiff with your mom over EMPTY COLD DRINK BOTTLES?  No, I am not here to rub it in, but I just want to remind you how smart the box, the crate where you put those empty as well as full bottles is!

15 Variable  Memory can be compared to a set of empty boxes.  When a variable is declared a box is reserved for it and the values that are assigned are put in the box.  When you change value that old value id declared and the new value is written I the box. 1. A name used to identify a data in the memory is called variable 2. The value of the variable can keep changing (varying) X5X5 Y9Y9 X10X10 Y9Y9

16 Variable 1. 4. The first character must be Letter Under score 2. 5. The maximum length of variable name as per ANSI standards is 31 characters, however, it is dependent on complier 3. 6. The variable names are case sensitive hence sum, sum,sum sum ans sum are considered as different variables 1. Rules for defining variable name 1. Variable name cannot to same as keyword 2. Variable name consists of Letters Digit Under score 3. 3. No other special character is allowed

17 Points to remember in C programming 1. Header files should be include before the main ( ) function 2. A C program should always contain a mina() function 3. Execution of C program starts from the first opening curly brackets after main( ). 4. Two functions with same name are not allowed in C program. 5. Normally C program consists of lower letter alphabets 6. Identifiers are case sensitive 7. There should be at least one blank space between two words of a c program 8. Usually C statements end with a semicolon. 9. Comment can be inserted whenever a blank space be inserted 10. Every opening curly bracket should have a corresponding closing curly bracket

18 Execution of C program Write a program using any text editor known as the source code the extension of the source file is “c” Then we compile the source program into machine it does the work of converting a sources program into machine language program known as object,code or object program the extension of object code is “obj” The object code is then linked needed with the library functions giving executable program or executable code using a linker The extension of executable code is “exe” finally executable code is loaded on to memory by a program called loader along with the data required to give us the output editor translator linker loader output Source code Executabl e code Object code

19

20  It really does not matter who invented it, what transpired and the other things that go with it  It is the most logical programming language and an old timer like me can vouch for it  If you get this, you get any programming language, including object oriented programming

21 History of C C originated in 1972 in bell laboratories. C was created by Denis. M. Ritchie It was derived from Basic combined programming language commonly known as BCPL C is used for developing all kind of software.hence it has come to be known as general purpose programming language Although born in 1972, it was standardized in 1989 by American National standers institute (ANSI).from there on it came be known as ANSI C. C is as structured language IT allows out program to be broken into small pieces known as functions. These functions once generated are reusable. IT allows our program to be broken into small known as functions. These functions are generated as reusable

22 Usually program written in C can be ported to different machines having different operating system and compliers with almost negligible modification. Thus it is considered to be portable language


Download ppt "Introduction. Natural Languages are languages of the Humans These Languages tend to be ambiguous A sentence in natural may not have just one meaning I."

Similar presentations


Ads by Google