The block diagram of the computer system have the following three units, a) INPUT UNIT b) CENTRAL PROCESSING UNIT c) OUTPUT UNIT INPUT UNIT *Accept data and instructions from the outside world *convert it to a form that the computer can understand *supply the converted data to the computer system for further processing. Example: Keyboard, Mouse, Light Pen, Digitizer, Track Ball, Joystick, OCR, OMR, MICR CENTRAL PROCESSING UNIT It is the heart of the computer system i.e. all operations are carried out in CPU only. The CPU is sub divided into following sub system i)Control Unit ii)Arithmetic and Logical Unit iii)Memory Unit a) Primary Storage b) Secondary Storage CONTROL UNIT *it instructs the computer how to carry out program instructions. *it directs the flow of data between Memory and ALU ARITHMETIC AND LOGICAL UNIT *It performs all the arithmetic and logical operations *Arithmetic operations like addition, subtraction, multiplication and logical operations such as comparisons are formed in ALU MEMORY UNIT *it is the part of computer which holds data for processing and other information. OUTPUT UNIT: *the output unit of a computer provides the information and results of a computation to the outside world. Example : Monitor, printer, computer output microfilm, plotter.
4.FUNCTION PROTOTYPE *A function prototype declaration consists of the functions return type, name and arguments list *the following are the function prototype i)function with no arguments and no return value. ii)function with arguments and no return value. iii)function with arguments and with return value. iv)function with no arguments and with return value.
Function With No Arguments And No Return Value. *in this prototype, no data transfer takes place between the calling function and the called function *the called program does not receive any data from the calling program and does not send back any value to the calling program. Syntax main() fun1() { { ```` ..... ```` ..... fun1(); } ```` ```` } Example Program #include<stdio.h> OUTPUT void main() Enter Two Number...2 3 { The sum is.....5 void add(void); add(); } void add() { int a,b,c; printf("enter two numbers..."); scanf("%d%d",&a,&b); c=a+b; printf("the sum is...",c); }
Function With Arguments And No Return Value *data is transfered from calling function to called function *the called program receives any data from the calling program and does not send back any value to the calling program. Syntax main() fun1(x,y) { { ```` ..... ```` ..... fun1(a,b); } ```` } Example Program #include<stdio.h> OUTPUT void main() Enter Two Value....2 3 { The Sum is....5 void add(int,int); int a,b; printf("enter two value..."); scanf("%d%d",&a,&b); add(a,b); } void add(int x,int y) { int z; z=x+y; printf("the sum is.....%d",z); }
Function With Argument And With Return Value *data is transfered from calling function to called function *the called program receives any data from the calling program and does not send back any value return to the calling program. Syntax main() datatype fun1(x,y) { { ```` ..... ```` ..... c=fun1(a,b); return(z); ```` } } Example Program #include<stdio.h> OUTPUT void main() Enter Two Numbers....2 3 { Result Is...5 int add(int,int); int a,b,c; printf("enter two numbers..."); scanf("%d%d",&a,&b); c=add(a,b); printf(result is...%d",c); } int add(int x,int y) { int z; z=x+y; return(z); }
Function With No Arguments And With Return Value *in this prototype one way data communicate takes place *the calling program can not pass any arguments to the called program but,the called program may send some return value to the calling program` Syntax main() datatype fun1() { { ```` ..... ```` ..... c=fun1(); ..... ```` return(z); } }
Example Program #include<stdio.h> OUTPUT void main() Enter Two Numbers...2 3 { Result In...5 int add(); c=add(); printf("result in...%d",c); } int add() { int a,b,c; printf("enter two numbers..."); scanf("%d%d",&a,&b); c=a+b; return(c); }
5. STRUCTURE A Structure contains one or more data items of different data type in which the individual data elements can differ in type. DECLARING A STRUCTURE *A Structure can declared with the keyword struct Syntax struct structure_name { structure element 1; structure element 2; ............... structure element n; };struct structure_name v1,v2...vn;
INITIALIZATION OF STRUCTURE *The initialization can be made at the compile time example 1 example 2 struct struct std { { int sno; int sno; float avg; float avg; }std={39,39.77}; } main() { struct std person1={39,39.77}; }
ARRAYS OF STRUCTURE Example struct book { char name[10]; int price; int pages; } struct book b[3]; POINTERS TO STRUCTURES *A Pointer can be declared in such a way that it points to a structure data type. Example Program #include<stdio.h> struct student { int roll_no; char name[10]; float marks; }stud l; void main() { struct student *pt; pt=&stud1; printf("enter student details:\n"); scanf(%d%s%f",&stud1.roll_no,stud1.name,&stud1.marks); printf(%d%s%f",stud1.roll_no,stud1.name,stud1.marks); printf(%d%s%f",pt->roll_no,pt->name,pt->.marks); }
Computers & Geosciences Volume 37 Issue 2 2011 [Doi 10.1016%2Fj.cageo.2010.06.008] Faisal Shahzad; Richard Gloaguen -- TecDEM- A MATLAB Based Toolbox for Tectonic Geomorphology, Part 1- Drainage Network Preprocessing An