Skip to content

SejalCh/Pointer-Basics-in-CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pointer-Basics-in-CPP

##AIM: To study about basics of pointer in C++

##THEORY:

In C++, pointers are variables that store the memory addresses of other variables.If there a variable 'var' in the program, '&var' will give us its address in the memory.We can call a pointer in the program either by its value or reference(discussed later).

##Syntax: (data type)(*variable name)

Some advantages of using pointers:
(i) Pointers make the programs simple and reduce their length.
(ii) Pointers are helpful in allocation and de-allocation of memory during the execution of the program.
(iii) Pointers enhance the execution speed of a program, etc.

##ALGORITHM: To display a pointer value and its address
step1: define a pointer such as int *var1 and a variable int var2
step2: assign an int value to var2
step3: assign address of var2 to var1 (var1=&var2)
step3: display the value of the variable by using pointer(*var1)
step4: display the address (var1)

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages