“C” Language
Definition of Computer:- Computer is an
electronic device which takes some input by
user ,process them and generate some output
according to user requirement.
Difference between computer and calculator:-
O.S. :- (Operating System)
OS is a system software . it is a interface between user and
computer hardware and computer HW does every work using
OS, first of all OS perform booting process ( means check all
connected H/W ) and provide one interface ( Eg. Dos Prompt /
desktop ) . OS operates application SW ( word , excel , IE ,
Windows Media Player)
FUNCTION OF OS
•Process management
•Memory management
•File management systems
•Device management
•Security
•System Performance
FUNCTION OF OS
Process Management : In multitasking OS , we can execute
more then one task simultaneously ,and OS also support
synchronization B/W all these processes .
Memory Management : In multitasking OS , this is the
responsibility of OS to allocate memory(in RAM ) for their
execution .
File management : OS also support different functionality related
to file / directory like open a file ,close file , create file / directory ,
copy , paste , rename etc .
Deice Management : Computer uses different Input Output
devices (sound card ,graphics card , wifi , printer ,kb etc ) and all
devices work using drivers .OS track all devices and assign task .
Security : OS prevent Your computer by unauthorized access
System Performance : OS always watch system performance
( its speed ) and record it and also improve its performance .
Computer Language:- it’s a way of communication between
user and computer.
There are three categories of computer language
Low Level Language : It’s a computer language , through which
we can directly interact with hardware , and it does not require
complier because though low level lang. we direct access
registers. It is tough in learning due to its complex syntaxes , and
its use to implement assembly programming or system
programming .
Example : assembly lang. and machine lang.( 1 ,0 )
Middle Level Language : In middle level computer lang. we can
make the programming of both levels , Low Level as well as
High Level .
High Level : In High Level programming language , we always
write programs in ENGLISH , so it require compiler to convert
High Level Lang . to Low Level ( Machine ) Lang . It is easy in
learning due to its easy syntaxes and used to implement
application programming
Example : BASIC , Cobol , Pascal , Fortran , Java , PL/SQL ,
Python ….etc
History of C Language:-
It is invented by Dennis Ritchie in 1972 at BELL
laboratories in USA
History of C++ Language:-
it is invented by Bjourn stroustrup in 1979 at
AT & T laboratories in USA.
-:CONSTANT:-
Definition:-Constant means fixed values which does not change
during execution.
Constant
Numeric Constant Character Constant
Note:- Single character constant always mention between in single
quotes and string constant mention between in double quotes.
All types of constant are called Rvalve
Note:-no constant can be given at left side of assignment(=)
operator. only given at right side of assignment operator
-:VARIABLE:-
Definition:-The value of variable can be change or vary during
execution.
All variable must be declared before they used, usually at the
beginning of function, before any executable statement
The declaration announces the property of variables..it consist of
a “type” , “name” and a “list of variable”.
Syntax:
Datatype variable _name;
•Datatype= defines what type of data is going to be stored in
variable.
•Variable_name = the name of variable
Rules of variable:-
1) The length of variable can not be more than 8 characters.
(compiler dependent).
Turbo c 8.
Borland c++ 30
Vc++ 30
ANSI 15
Ex:- int abcdefghijklmno;
2 ) The name of variable Can not start by digit.(Variable name
must begin with a letter.)
int 1abc.
int a1bc.
int abc1.
3 ) Space is not allowed in variable name . int ab
c.
4 ) No any special symbols are allowed in variable declaration,
only and only underscore is allowed everywhere .
EX:- int ab#c;
int _abc;
int a_bc;
int abc_;
int ab-c;
5) operators are not allowed.
int ab-c;
6)- Keywords are not allowed.
int if; //error
int else. // error
KEYWORD:- Keywords means reserved words ,heaving
special meaning which is used only by
compiler, and user can not use as a variable
or identifiers
7 ) We can’t declare more then one variable with same name
(neither same type ,nor different type otherwise result will be
error)
• variable names are case sensitive.
Ex:- variable Total is not same as variable total;
Invalid variable name
• 123
• (abc)
• 6bc
• %abc
-:DATATYPE:-
Definition:- the stored information is called data and the type of data is called
datatype.
Ex:-
COMPILER:- It is a software which is used to convert high level
language(English) to low level language(binary 0,1). Or source code to
machine code .
units of the memory:
Bytes :- Unit of the memory
Bites :- Smallest unit of the memory.
1 Kbytes = 1024 bytes
1 Mbytes = 1024 Kbytes;
1 Gbytes = 1024 Mbytes;
1 bytes = 8 bits;
DATATYPE SIZE(in Byte) Range
int 2
short int 2(TC),1(ANSI)
long int 4
unsigned int (+) 2
float 4
double 8
long double 10
char 1
unsigned char(+) 1
• formulae :-
Fundamental data types are:-
• char – For character and string
• int – For integers
• float- For numbers with decimals
data type modifiers:-