You are on page 1of 11

COMPUTER FUNDAMENTALS

COMPUTER: Computer is an electronic machine. Which take input in the form of the data and instructions through input unit. This input goes to its processing unit. Where data process according to instruction and give output to output unit.

I/P UNIT

ALU

O/P UNIT

INPUT DEVICES: i. ii. OUTPUT DEVICES: i. ii. PROCESSING UNIT: i. ii. iii. iv. Mother board Processor Memories Casing Monitor Printer Key Board Mouse

CU

DATA: Facts and figures are called data. INSTRUCTION: The command which process the data called instruction. DATA FORMATS: i. ii. iii. iv. v. Text Pictures Numbers Audio Video

HARD WARE: Physical components of computer system are called hard ware. SOFTWARE:

SET OF PROGRAMS PROGRAM :SET OF INSTRACTIONS The programs like (windows, Ms Word, Ms Excel) called software. TYPES OF SOFTWARES: i. ii. OPERATING SYSTEM: That softwares through which user can operate the computer system like (Dos, Windows) APPLICTOIN SOFTWARES: Those softwares in which user can create or run any application called application softwares like (Ms Word, Ms Excel, paint, internet etc)

OPERATING SYSTEMS: 1. DOS (CUI) COMMAND USER INTERFACE: In (CUI) user can operate the computer system through commands. 2. WINDOWS (GUI) GRAPHICAL USER INTERFACE: In (GUI) user can operate the computer system through graphics. DOS (DISK OPERATING SYSTEM): Dos run through the following files. Command. Com Io.sys Ms Dos.sys Dos interface is called DOS prompt A:\>C:\>In Dos user operate the computer through Dos commands. There are two categories of commands. DOS INTERNAL COMMANDS DOS EXTERNAL COMMANDS INTERNAL DOS COMMANDS : Internal Dos commands load through command.com file in computer memory. DIR CLS CD MD RD (display the list of files and directory) (clear the last screen) (change directory) (make directory) (remove directory)

DATE TIME VOL VER COPY

(display and change the current date) (display and change the current time) (display the volume label of the drive) (display the version of the O/S) (copy files from one location to other location)

EXTERNAL DOS COMMANDS : External Dos commands run through their executable files. Label Diskcopy XCOPY location) SYS (display and change the volume label of drive ) Run through Label.EXE file (Make a copy of Floppy disk to Floppy Disk ) Run through diskcopy.EXE file (Copy Directories, sub directories and files from one location to other Run through xcopy.exe file (Copy DOS bootable files from one drive to other drive) Run through sys.com file (Formatting of HDD or Floppy Disk) Run through format.com file (display and change the current date) (display and change the current time) (display the volume label of the drive) (display the version of the O/S) (copy files from one location to other location)

Format DATE TIME VOL VER COPY

C-LANGUAGE NOTES

Some words about Computer Programming languages Naturally a language is the source of communication between two persons, and also between person to machine like computer. The languages we can use to communicate with the computer are known as Computer programming languages. Generally there are two major types of languages are available are as follows: 1. Low level languages 2. The set of commands available in low level is complex and not easy to understandable. In this category " Assembly " and " machine codes " are available. Assembly programs are faster than other high-level language programs. 3. High level languages The set of commands available in high level language is very simple and easy to understandable. High level languages are further divided into two major categories. 1. Procedure Oriented language 2. In this category we are able to create our project or programs using procedural approach means in this type we can able to divide our big project/program into small subroutines or procedures. After making procedures we can able to call a procedure one or more places. The lists of procedural languages are as follows: C language C++ (Object Oriented) Java (Objected Oriented) Smalltalk (Objected Oriented) Pascal language 3. Non-Procedural Languages: This category also known as Problem Oriented languages. In this type of languages we can able to make program only at specific range like database. The followings are the examples of Non procedural languages 1. SQL (Structured Query Language) 2. SNOBOL (String processor)

C LanguageHistory

Developed at Bell Laboratories. first standard version release in 1972. Developed by Dennis Richee. Before c a Programming language is very popular in those days the name of the language is B-Language so the developers decided the name of C language because C is next to B.

Editors :
UNIXC
TURBOC AT&T C BORELANDC The Integrated Development Environment (IDE): Turbo c features as integrated Development environment, or IDE,. It is also referred to as the programmers platform.) in IDE you can able to write/save/open your programs or code, compile using short cut keys, and also perform code debugging very easily.

IDE
Common Short cut Keys Description F2 press to Save current work F3 press to open an existing file ALT-F3 press to close current ALT-F9 press to compile only ALT-F5 press to view the desired output of the program. CTRL-F9 press to compile+run ALT-X or ALT-F-X press to exit from TC IDE C Programs Skeleton (General) <Preprocessor Directives (some time necessary)>

<Macros Definition (optional)> <function declaration> < Global Variable (on your demand)> main () (Necessary) { statements } < function definition> {} Remember Some common rules for writing C program

Use all commands or statements in lower or small case. After completion of a statement excluding main() or loops must insert ; (semicolon) as a statement terminator. Dont use/declare identifier or variable name same as statement name suppose int include; this is a wrong statement because include has a special meaning in the language. Header Files or Preprocessor Directives contains references or links of library functions. That is built-in in the C language. Suppose if you want to use a function clrscr() ; in the main function so must be declared on top # include <conio.h> other wise you could have an prototype error. Some header files are as follows

Stdio.h
Conio.h Dos.h String.h Stdlib.h

And many more header files are available in C void main(void) Every C programs consists of one or more functions. No matter how many

functions there are in a C program , main is the one to which control is passed from the operating system when the program is run ; it is the first function executed. The word "void" preceding "main" specifies that the function main() will not return a value. The second "void," in parenthesis , specifies that the function takes no arguments. printf() printf() is built-in function we can display with printf() any message, variable value on screen/file/printer.

In printf() we can use many escape sequences and format specifies. Escape sequences are special notations through which we can display our data
Variety of ways: Some escape sequences and their functions are as follows: Escape Sequence \n \t \ \" \r \b Description Perform line feed & Carriage return operation Prints a tab sequence on screen Prints a single quote character on screen Prints a double quote character on Screen Perform carriage return operation Remove one character from left Example printf("A\nB"); printf ("A\tb"); printf ("\a\"); printf ("\"a\""); printf ("a\rb") printf ("a\bHi!" );

Example Program #1 #include <stdio.h>


#include <conio.h>

void main(void)

{ printf( " Example Program (Escape Sequence) \n"); printf( " -----------------------------------------------\n"); printf( "Escape sequnce \t Meaning\n"); printf( " -------------------------------------------------\n"); printf(" \\\\ \t \\" \n"); printf(" \\\ \t \ \n"); printf(" \\\" \t \" \n"); printf(" \\n \t line feed & carriage return\n "); printf(" \\t \t Tab characters or eigth spaces\n"); printf(" \\b \t Erase one char from right to left\n"); printf(" \\r \t perform only line feed\n"); getch(); } This program produces following output Example Program (Escape Sequence) -------------------------------------------Escape Sequence Meaning ------------------------------------------

\\ \ \
\" \" \n line feed & carriage return

\t Tab Characters or eight spaces \b Erase one char from right to left \r perform only line feed Example Program #2
#include <stdio.h> #include <conio.h>

void main(void) { clrscr(); printf( " \" India ZindaBad\" \n"); getch(); } This program produces following output "India ZindaBad" Description : in the above we use a escape sequence \" this will produce " on screen after that a message Pakistan ZindaBad is appear after the message another " ( double quotation) appear on screen because of \" Variable : variables are named peace of memory in which we can store our data and manipulate our data. Variables are used so that same space in memory can hold different values at different times. In C language following are the list of data type available through which we can define our variables:

int (Example :int a,b,c) float(Example:float pi;) char(Example :char opt;) long(long bigval;) double(double bigval;)

CHARACTERISTICS OF C LANGUAGE/MAIN FEATURES


1. Modularity. 2. Portability. 3. Extendability. 4. Speed. 5. Flexibility. Modularity: Ability to breakdown a large module into manageable sub modules called as modularity, that is an important feature of structured programming languages. Advantages: 1. Projects can be completed in time. 2. Debugging will be easier and faster. Portability: The ability to port i.e. to install the software in different platform is called portability. Highest degree of portability: C language offers highest degree of portability i.e., percentage of changes to be made to the sources code are at minimum when the software is to be loaded in another platform. Percentage of changes to the source code is minimum. The software that is 100% portable is also called as platform independent software or architecture neutral software. Eg: Java. Extendability: Ability to extend the existing software by adding new features is called as extendability. SPEED: C is also called as middle level language because programs written in c language run at the speeds matching to that of the same programs written in assembly language so c language has both the merits of high level and middle level language and because if this feature it is mainly used in developing system software. Flexibility: Key words or reverse words ANSIC has 32 reverse words C language has right number of reverse words which allows the programmers to have complete control on the language. C is also called as programmers language since it allows programmers to induce creativeness into the programmers.

You might also like