C Programming Language-Basic Fundamental of Programming 12
C Programming Language 01. Basic Fundamental of Programming Topics Covered: 1. Characteristics of Computer. 2. Software 3. Program 4. Types of Software 5. Programming language and it’s type 6. Translator 7. Procedure oriented programming language 8. Computer program error 9. Computer program characteristics 10. Editor
Made By:-Harsh Raval
Page 1 of
C Programming Language-Basic Fundamental of Programming 12
Page 2 of
(1). CHARACTERISTICS OF COMPUTER: Following are the characteristics of computer. 1. Speed: Computers are working at very high speed. For example, it can add or multiply 20,00,000 numbers in a second. Speed of computer is specified in MIP (Million Instructions per Second). 2.
Accuracy: Computer does every work with high accuracy. Computer never makes mistake but it is the mistake of programmer or data entry operator.
3.
Without Tiredness and laziness (Diligence): Computer works continuously without tiredness or laziness. It can print 10,000 salary slips or 1,00,000 share holders certificate continuously.
4. Multiple use (Versatility): Computer can be used for the multiple uses. Computer can be used to write a letter, print balance sheet, entertainment, etc. 5.
It can store data: Computer can store large amount of data. You can store your work into computer and we can use same work later on when we need it.
Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 3 of
6. It has not its own intelligence: Computer has not its own intelligence. Its only work according to program, which is written by programmer. It cannot work by its own way. 7. It has no Emotions: Computer is not a living thing so it has no any emotion. (2). SOFTWARE: A group of programs that are put into a computer to operate and control its activities is called software. (3). PROGRAM: Program is collection of group of multiple executable statements (instruction), which are combined to give the result. (4). TYPES OF SOFTWARE: The software may be classified into two categories: 1. System software: System software is a group of general program use to help users to manage computer resources and to run their application program effectively. These are complex program and are developed and supplied by computer vendors. Operating system, compiler, linker, loader, editor, etc. are system software. Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 4 of
2. Application software: Application software is a set of program to perform operation for a specific application. Word, Excel, Access, Photoshop, etc. are application software (5). PROGRAMMING LANGUAGE AND IT’S TYPE: Programming language is a language used to give instruction to computer. Each computer language has its own syntax. From last few years many programming languages are developed for different purpose such as COBOL is developed for the business application, FORTRAN is developed for the scientific calculation and other purpose. We can classify the programming language in mainly following category: 1. Machine language: Computes are made of two-state electronic components, which can understand only pulse (ON or 1) or no pulse (OFF or 0) conditions. Therefore, all instructions and data should be written using binary codes 1 and 0. The binary code is called the machine code or machine language. st o It is also known as the binary language, or 1 generation language. o All computers are not same in design so machine language is also different for different computers. Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 5 of
o Advantages: I. The execution of program developed in machine language is fast than other language. o Disadvantages: I. It is difficult to write, and understand the various combinations of 1 and 0 so to write code for machine language is slow and difficult. II. Every computer has its own machine language so program developed for one computer cannot be used in other computer. 2. Assembly language: o It assembly language special symbols or code for different purpose (for operator, constant, etc.). These symbols are known as mnemonic codes. o It is based on the machine language so the program developed for the machine is different for different computer o To convert assembly language into machine language special translator (software) is need known as Assembler. o The execution of program written in assembly language is faster than the higher-level language but slower than machine level language. o To write and understand a program in assembly is slow and difficult but easier than the machine level language. nd o It is also known as second level language or 2 generation language. o It is also one of the types of low-level language. Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 6 of
3. High level language: o These languages consists a set of words and symbols and we can write a program using it, which is similar to English like language. o It is mainly consider the problem to be solved rather than computer instruction. o It is user-centered rather than machine-centered. o C, C++, COBOL, PASCLE, FORTRAN are examples of the high level language. rd o It is also known as 3 generation language. o Advantages: I. It is not machine dependent so program written for one computer can be run on different computer. II. It is easy to understand and write. III. Error can be easily detected and removed. o Disadvantages: I. It is slower than the assembly language and machine language. II. It requires special software to convert code from High-level language to machine code that is known as Translator. III. Translator can be divided into two categories: One is Compiler and another is Interpreter 4. Fourth generation language: o It is one type of higher-level language but programmer can make program fast and easily in this language. o Visual Basic is an example of Fourth generation language. Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 7 of
(6) TRANSLATOR: To convert your higher-level language program into machine level language program, there is use of special software or program that is known as Translator. Translator can be divided into two categories: (1) Compiler: Complier is a program, which checks the syntax error in your program and converts your program into machine language from higher-level language. If there is any error in any line of program compiler give error message and doesn’t covert your program into machine level language. But it is faster than the interpreter. Compiler is used in C, C++ program. (2) Interpreter: Interpreter is a program which checks your program line by line and after checking first line it converts into machine language and execute it so it is useful for the line by line tracing of your program. It is slower than compiler. It is used in Java program. (7). PROCEDURE-ORIENTED PROGRAMMING LANGUAGE: Programming in the high-level languages such as COBOL, FORTRAN, C, etc. is known as procedure-oriented programming. Procedure-oriented programming basically contains writing of instruction (statement) of the computer and putting these instructions into group known as Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 8 of
function. There are multiple functions into the program. That means we are dividing out program into multiple function.
Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 9 of
Program
Function-1
Function-2 Fig.1 Program and Function
Characteristics of procedure-oriented programming language: 1. It emphasis {Bir aipvi[} on how to does this. 2. Large programs are divided into smaller programs known as functions. 3. Function can communicate by global variable. 4. Data move openly from one function to another function. 5. Functions change the value of data at any time from any place. 6. It uses top-down programming style. (8). COMPUTER PROGRAM ERROR: There are two types of errors occur in our program. 1. Syntax (Compile time) Error: Syntax error occurs due to improper word; violation of condition of writing program, or some missing thing that means it is the error in syntax of program. This error occurs when you compile your program so it is also Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 10 of
known as the compile-time error. This error can be easily detected and solved. 2. Execution (Run time) Error: This error occurs mainly when you run your program so it is known as execution (Run time) error. It is occupy mainly due to incorrect logic so it is also known as logical error. It is very difficult to detect and correct runtime error.
(9) COMPUTER PROGRAM CHARACTERISTICS: 1. Integrity: Your program should not violate the rules, which are applied to the real world. For example the age of the man is 100 and if you enter age 150 then it should not be allowed in computer. 2. Simplicity: Your program should be simple so it can be read and understand easily. Also it should not be very complex (confusing) so it requires more time for computer to execute.
Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
Page 11 of
3. Clarity: Program should be written in some formatted way. Appropriate name should be chosen in your program. There should be proper use of indentation, space. We have to provide the comment (description) so it is becomes clearer. (10) EDITOR: Editor is a system program allows adding, deleting and manipulating the text. It provides several commands to add, delete and manipulate the text. It provides also the facility of save, save as, print as well as facility to copy, cut, paste, select, find, replace, delete the text. In market several editors are available such as DOS editor, notepad, WordPad, etc. Many programming complier also provides the facility of editor such as C editor, VB editor, etc which includes the facility to compile, execute, trace program. In C we are generally using Turbo C++ compiler, Borland C++ compiler, Microsoft C compiler, or many others. In Turbo C++ compiler there are several menus having File, Edit, Search, Run, Compile, and Help. File menu provides the facility to open, save, close file. Edit menu allows us to copy, cut, paste, find, replace, select, etc. operation on text. Search menu provides the facility to search, replace the text. Compile menu provides the facility to compile the program. Run menu allows us to run (execute) our program. Help menu provides the help on different topics. Made By:-Harsh Raval
C Programming Language-Basic Fundamental of Programming 12
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.
Page 12 of
PROBLEMS Define Software, Program, Programming language. Give the different types of Software. Explain the different types of programming language. What is Translator? Explain. What is Assembler? Explain. What is Interpreter? Explain. What is Compiler? Explain. Give the difference between Interpreter and Compiler. What is Editor? Explain. Explain Assembly language. What is procedure-oriented language? Give its features. Give any three examples of procedureoriented language. Explain three characteristics of program Integrity, Clarity, Simplicity with its importance. Describe computer characteristic. What is syntax error? What is execution error or runtime error?
Made By:-Harsh Raval