Automatic storage classes arrays in programming language number system eapcet engineering stream material
AUTOMATIC STORAGE CLASSES:
Module scope/code blocked scope
Storage on system memory
Auto keyword
Validity upto invoking the block+++
Default storage data unpredictable
Syntax:
Auto
<data type><identifier> =<value>;
Auto int x;
All the
elements are individual
There is no
dependent elements
Elements are
identified by the indexes
To find the
elements in a matrix format by useingthe index point of row and column
Array is
called as related elements but same datatype , homogeneous data elements
DYNAMIC
MEMORY ALLOCATION
MALLOC
() REALLOC() CALLOC() FREE()
MALLOC()
It is used
to allocate single block of memory
Syntax :
<ptr
location>=<type declaration?malloc<pointer or buffer size>
Dynamic
memory allocation methods available
stdlib.h
Ptr=<int*>malloc(size
of(int));
CALLOC
To allocate
multiple blocks of memory
Syntax :
<ptr
location>= <type conversion> calloc(n,buffer size);
Ptr=<int
*> calloc(3,size of(int)))
POINTERS:
Pointers are
used to identify the address of another variable
This
variable is stored in memory
Pointers
also one type of variable / identifier
Pointers are
identify the asterisk operator
Address is
also stored on some other address in the memory
Pointer
terms
*---------à pointer
&…………..>
address
*(*)…………>actual
value (pointer of pointer)
*(&)…………..>
actual value (address of pointer)
How to
declare pointers
Pointers are
declared by the primitive data types
Primitive
data types followed by the initial name
Pointer is a
prefix of the variable
<data
type > *<literal name>
Int * p;
{
Int x,*p;
X=5
P=&x;
Pr(“%d”,*p);
}
ARRAYS IN PROGRAMMING LANGUAGE :
Collection
of related data items or collection of same data items stored in a common
memory (shared memory)
Homogeneous
data items
Arrays are
used to implement sequential memory allocation
Key terms :
Default
index starts with zero
Array
indexes must be integer
Group of
indexes called as indices
L bound of
array zero
Bootimg
index zero
U bound
(n-1) some times it is called asterminated index
Last index
(n-1)
Components of an array
Data type
array name size
Datatype
……………… user defined
Predefined
Syntax :
Declaration
of an array
<data
type > <array name[ size];
Int x [5]
How to
initialize the array :
We can
assign
Based on
assignment operator
Association
based on right to left
<array
name> [index] =<value>
Ex : x(0) =
10;
Array name
index =0 value 10
Types of
array initialization:
First form
notation
Second form
notation
R to l
By using
index
Ex : int x[5]
first form
X[0]=10
Second form
:
Right to
left *without proper space ‘
Without
index
Int x[5]
={10,20,30,40};
Number are
elements which are mentioned in the curly brace in size of array
How to
access the array elements :
By using
loops
{
Int x[]
=(10,20,30,40,50);
Int I;
For(i=0
i<x.length; i++}
Pf(“%d”,x[i]);
While loop
It is a
entry controlled loop
Note: cursor
checks for the condition before execteing the statements
Syntax :
Int ;
While cond
{
-----
------
}
While is
called as entry controlled
Which of the
following loop is called as entry controlled …………while
Do-while
Exit
controlled loop
Int
Do
{
------
-----
++/--;
While(cond);
Int i=0;
Do
{
Printf(‘%d”,i);
I++
}while(i<5);
Structure
Declare a data
structure format in multiple data types declaration is based on keyword struct
followed by the structure name
Struct
<structure name >
We can
access numbers from the structure by using the keyword or user defined tags
Struct
<sname><tag name>
In c++ java
it is called as object
Structure
test t :
To create
relationship between structure members and tag by using period operator (.)
<tag name
>.<structure member>
Ex: t.htno;
We can
assign the values to the structure members by using assignment operator(=)
Syntax :
<tag name
>.<member name >=<value>
Ex:
t.acc number
=”12345”
how to
declare structure
struct
<structure name>
{
----------
-------------
<data
members of the structure>
}
Struct
employee
{
Int emp id
Char ename
[15]
};
How to declare structure with in a
structure :
Nested
structures
To declare1
structure tag in another is called as nested structures
Ex:
Struct tesgt
1{
Int account
number
}
Struct test
2 {
Struct test
1 T1;
Int mobile
number
};
Struct test
2 T2;
N nested
structure declaration is also possible in nested structures
How to
declare arrays to the structures
What is the
main use of arrays with structures
To store
multiple records in structure --- arrays
How to
create tables in c --- structures
Struct
customer {
Int cid
Char cname
[20]
Int number ;
};
Struct with
arrayare used to create relationship structures
Struct
<sname>
{
--------
----------
}
Struct
<s.name>< tag name> [size]
It can
support n arrays
Struct
customer {
Int cid;
Char cname
[20]
};
Struct
customer c[5];
Note :
How to
access multiple records from array with structures
By using
loops
C[0].cifd=123
UNION
Union are
used to find the random memory location
Unions are
declared by using the “union” followed by union name
Wec can
access the members from the union by using tag
To create a
relationship between union tag and the union members by using period operator
(.)
Syn:
Union<union
name>
{
…………
…………
};
Union test {
Int number ;
};
To access
the number from the union
Union test
t{
t.number
=12345
UNION ARRAYS
It is not
possible to implement nested union
Reason :
randomization allocation
Nested
unions are not possible in
UNION TEST {
INT number
};
Uniton tesy
t[5];
To access
union array loops
If the
structure ofunion contains n indexes loops are must be in the nesyed format
Registers :
Module/code
block scope
Register
Data storage
on processor register
Invoking default value unpredictable
Syntax :
Register
<data type><name>=<value>
Register int
r;
Static :
Module or
functional or code block scope
Static
keyword default size zero
System
memory storage allocation
Syntax:
Static
<data type> <identifier name > =<value>
Static int
s;
External :
Global
scope,unpredictable,extern,system memory
Extern<data
type><identifier>=<value>
Operator
over loading:
To solve the
complex problems
Data
authentication data secrecy complex problems
<data
type> operator<symbol>
{
……
…..
}
Void
operator +()
{
…….
……..
Count 10+20;
Which
symbols are not allowed operator over loading
(,),{,},[,],,,:,;,-
All
arithmetic relational bitwise conditional operators allowed
Note :
To invoke
the operations in operator overloading by using the prefix of the object
Class test
{
Algorithms
in programming language :
Step by step
description allowed in algorithms step by step description to solve real world
task to identify the solving descriptions of the real world data
It is a
procedure used to solve the problems in a step by step manner
COMMANDS IN THE ALGORITHM
COMMAND
PURPOSE
START
-------------- To begin the algorithm
Begin
…………………to activate the algorithm
Process……………..
to execute the algorithm
Compute…………..to
execute the statement
Cond………………….to
find the conditions
Lt………………….lessthan
Ltq………………lessthan
or equalsto
Gt……………….greater
than
Gtq……………greater
than or equals to
Eq/eql………………….comparison
Comp……………comparison
Stop……………to
terminate the algorithm
End……………to
terminate the algorithm
NUMBER SYSTEM
BINARY
NUMBER SYSTEM
DECIMAL
NUMBER SYSTEM
OCTAL NUMBER
SYSTEM
HEXA DECIMAL
NUMBER SYSTEM
Binary
number system :
It is used
to identify the electronic storage data in binary number system base value 2
range 0,1
Decimal
number system :
Find human
readable numbers
Base value
10 range 0------9
Octal number
system :
To display
the data on digital circuit boards
Symbol base
value range
Hexa decimal
number system :
Mainly used
for identifying the memory address
Address
based on alpha numbers
16 base
valuerange 0---------9 A------------F
Bcd
conversion :
0+0 =0 0+1 =1
1+0 =1 1+1=1
0 is result
1 is carryforward
Data transfer :
Void display
(5,6)
Void
display(int,int)
Types of functions
Predefined functions
A function
which are defined in programme or platform header files are preprocessors or
packages or apis are called as pre defined functions
These are
called as system defined functions inbuilt functions existing functions
Header file
registered functions
Api---
application programming interface
<sgtdio.h>
<iostream.h> java.io.*
User defined
:
These
functions are declared defined by the user according to his programme
requirements
No—no
No—with
With—no
With---with
Components of the method(parts of the method)
Data type
,method type, parameters ,body
Which of the
following is a mandatory component for the user defined function data type
return type
Which part
of a method is option parameters
Function
----- to create code blocks
Default arguments or default parameters
To ignore
the user inputs
Void
display(int x,int y=20)
What are the
types of functions in pure object oriented programming
Bascic
functions
Mutator
functions
Accessor
functions
Mutator functions
It is also
called as setters it is also used to assign the values to literals
It is used
to invoke instant variables
It is used
to implement the keyword
Operator is
set assignment operator it is used to return the values
A function
contains more than one function a class contatins more than 1 class
Function
names are same and return type is also same but number of parameters are
different ------over loading
Importance :
buffer reusability mechanism
Class test
{
Void display
(int x )
{
}
Void display
(int x int y)
}
Void display
(int x int y int z);
}
Method over
loading is a polymorphism
Polymorphism
is a memory reusability
Void
operator +()
{
……………..
……………
}
Void main ()
{
Test T
+T;
}
Algorithms
in programming language :
Step by step
description allowed in algorithms step by step description to solve real world
task to identify the solving descriptions of the real world data
It is a
procedure used to solve the problems in a step by step manner
COMMANDS IN THE ALGORITHM
COMMAND
PURPOSE
START
-------------- To begin the algorithm
Begin
…………………to activate the algorithm
Process……………..
to execute the algorithm
Compute…………..to
execute the statement
Cond………………….to
find the conditions
Lt………………….lessthan
Ltq………………lessthan
or equalsto
Gt……………….greater
than
Gtq……………greater
than or equals to
Eq/eql………………….comparison
Comp……………comparison
Stop……………to
terminate the algorithm
End……………to
terminate the algorithm
NUMBER SYSTEM
BINARY
NUMBER SYSTEM
DECIMAL
NUMBER SYSTEM
OCTAL NUMBER
SYSTEM
HEXA DECIMAL
NUMBER SYSTEM
Binary
number system :
It is used
to identify the electronic storage data in binary number system base value 2
range 0,1
Decimal
number system :
Find human
readable numbers
Base value
10 range 0------9
Octal number
system :
To display
the data on digital circuit boards
Symbol base
value range
Hexa decimal
number system :
Mainly used
for identifying the memory address
Address
based on alpha numbers
16 base
valuerange 0---------9 A------------F
Bcd
conversion :
0+0 =0 0+1 =1
1+0 =1 1+1=1
0 is result
1 is carryforward
Data transfer :
Void display
(5,6)
Void
display(int,int)
Types of functions
Predefined functions
A function
which are defined in programme or platform header files are preprocessors or
packages or apis are called as pre defined functions
These are
called as system defined functions inbuilt functions existing functions
Header file
registered functions
Api---
application programming interface
<sgtdio.h>
<iostream.h> java.io.*
User defined
:
These
functions are declared defined by the user according to his programme
requirements
No—no
No—with
With—no
With---with
Components of the method(parts of the method)
Data type
,method type, parameters ,body
Which of the
following is a mandatory component for the user defined function data type
return type
Which part
of a method is option parameters
Function
----- to create code blocks
Default arguments or default parameters
To ignore
the user inputs
Void
display(int x,int y=20)
What are the
types of functions in pure object oriented programming
Bascic
functions
Mutator
functions
Accessor
functions
Mutator functions
It is also
called as setters it is also used to assign the values to literals
It is used
to invoke instant variables
It is used
to implement the keyword
Operator is
set assignment operator it is used to return the values
A function
contains more than one function a class contatins more than 1 class
Function
names are same and return type is also same but number of parameters are
different ------over loading
Importance :
buffer reusability mechanism
Class test
{
Void display
(int x )
{
}
Void display
(int x int y)
}
Void display
(int x int y int z);
}
Method over
loading is a polymorphism
Polymorphism
is a memory reusability
No comments:
Post a Comment