Professional Documents
Culture Documents
C
C-language : C is mid-level & Structured Programming Language. Large
Programs are divided into smaller modules, each modules user
structured code.
C-language feature : Simple, Structured, Fast-speed memory
management , extensible.
Local-Variable Global-Variable
1. A variable declared inside a 1. A variable declared outsida
Block of code/ function is called Block of code/function called
a Local variable. a Global variable.
2. Scope of variable is available 2. Scope of variable is available
With in a function where it is through a program.
Is declared
3. Variable are Stored in a Stack 3. The compiler decider the
Unless specified. Storage location of available.
D
Dynamic Memory Allocation: Here memory is allocated at runtime, &
can be increased while executing a program.
Malloc() Calloc()
1) It Allocate the memory at the 1) It initialized memory without
Time of execution of program. 0 values.
2) It stans for Memory allocation 2) Calloc stand for contiguous
memory allocation,
3) it allocate multiple block of 3) It allocate Single block of
memory at same time. Memory at same time.
F
Function in c/c++ : They are used to avoid rewriting the same code
again and again in program.
• They are called from a any no of times & any places from program.
I
Inline function: Compiler take a copy of code of function at each point
where function is called.
Inheritance: Inheritance allows us to defined a class that inherited all
methods & attributes from another class.
Base
B1 B2 B3 Derived
Single Inheritance: In this, class is allowed to inherited from only one
class.
Base
Derived
Multiple Inheritance: In this, class can inherited from more than one
classes. i.e. one derived class is inherited from more than one base
class. Eg – Child has 2 parent Father, mother
Base Base
Derived
Multilevel Inheritance: In this type derived class is created from
another class.
Base
derived
derived
Eg: Family Tree Grandpa base class father first derived class & son
second derived class.
Hierarchical Inheritance: More than one derived class Created from
single base class.
Base
D1 D2 D3
D1 D2 D3 D4
1
Eg: class-base class-Cars & Audi, Maruti, Kia are derived class.
M
Method Overloading: It is a process of overloading the method that has
same name but different parameters.
Method: Method is defined inside class
Method can be private public Protected
Method is called using object only.
O
Operator Overloading : It is ability to provide operator or a special
meaning for a data type this ability called operator overloading
P
Pointer: A pointer is a variable whose value is the address of another
variable.
Used- i) Accessing the Array element
ii) Call by reference
iii) DSA like linked-list, Queue
iv) Dynamic memory allocation
NULL pointer: A pointer that does not refer to any address of value but
NULL. When we assign 0 value to pointer it become null pointer.
Polymorphism: It is an ability of programming language to present the
same interfaces for several different data type. E.g. Same entity
behaves differently in different scenarios
Compile time polymorphism, runtime polymorphism.
Compile-time polymorphism Run-time polymorphism
- In this method, we would - In this method we come to know a
Come to know at compile time which know run time which method
Method will be called & the call called the call is not resolved by
Is resolved by the compiler. The compiler.
- Access at compile time - Access at run time.
- It is known as static binding or – It is known as dynamic or late
Early binding. Binding.
- Execution Speed High - Execution speed is low
R
Recursion: When a Function call itself, the process known as recursion
& this function is known as recursive function.
1) Winding phase: when a recursive function call itself & this phase
end when the condition is reaches.
2) Unwinding Phase: Unwinding phase starts when condition is
reached, & control return the original call.
Reference : A reference is like pointer its another name of an existing
variable. Once reference name is initialized with a variable by the
variable name or reference name both.
S
Static-Variable: Static variable can be defined inside or outside of a
class. There default value is 0 & they are alive till execution of
program. Used- Static is used with global variable to set their scope to
containing file in local variable static is used to variable in statically
allocated memory instead of memory.
Static memory Allocation: Memory is allocate at compile time & can’t
increases while executing program. It is allocate using static keyword.
It is implemented using stack or heap but it required pointer to access
Variable from static memory. It is faster than dynamic.
Structure: Structure is user defined datatype that allows storing
multiple type of data in single unit. It is defined Outside of class.
Structure & Classes:
Structure Class
1 members of structure are by default 1) members of class are
Public by default private.
2 when deriving structure access 2) when deriving class access
Specifier are public by default. Specifier are private by default.
T
Token: Taken is Smallest Individual unit in program. It is identifier. It can
be constant, keyword, string literate etc.
V
Virtual-function: Virtual function is a member function which is
declared with in a base class & redefined by derived class.
- It is defined virtual keyword.