Important Revision For Data Structure:: Pointers
Important Revision For Data Structure:: Pointers
object oriented
*Pointers:
Example: Int x=5; Cout<<x; Cout<< &x; Cout<<*0044; :
x Error
w w=NULL; x 0044 5 x
10 10
Example 2: Void main() { Int v1=5; v2=15; Int *p1; Int *p2; P1=&v1; P2=&v2; *p1=10; *p2=*p1; P1=p2; *p1=20; Cout<<v1<<v2; Cout<< p1<<p1; }
v1 & v2
15 p1 10 10
10 20 v2
new Example: Void main () { Int *p; Int size; Cin>>size; P=new int[size]; For() Delete[]p; P=NULL; } integer
heap
*Struct :
struct
struct struct
struct
Struct
struct_name
{. Data member };
Ali.mark=85.5 Ali.phone=0797.
: Student Struct
Ali
: C.N.E