AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
6 pointers functions
1. Pointers to functions
09/04/131 VIT - SCSE
Functions to be referenced by a pointer
return_type (*variable)(list of parameters);
for example,
float (*p)(float,float,float);
p=&average;
3. Pointers and Arrays
09/04/133 VIT - SCSE
int value[5]={2,5,1,6,3};
int *p;
p=value; (take the address of 0th
location)
//p=&value[2]; (ok)
cout<<p;
cout<<*p;
4. Arrays of Pointers
09/04/134 VIT - SCSE
Int *p[3];
i.e p[0], p[1], p[2]
int a=4;
int b=6;
int c=2;
int *p[3];
p[0]=&a;
p[1]=&b;
p[2]=&c;
cout<<*p[0];
cout<<*p[1];
cout<<*p[2];
cout<<p[0];
cout<<p[1];
cout<<p[2];
6. 09/04/136 VIT - SCSE
#include<iostream.h>
void main()
{
int value;
int *p;
int **q;
value=100;
cout<<”value=”<<value<<endl;
p=&value;
q=&p;
cout<<”Pointer 1=”<<*p<<endl;
cout<<”Pointer 2=”<<**q<<endl;
}
7. Scope Resolution Operator
::variablename;
09/04/137 VIT - SCSE
#include<iostream.h>
int m=10; //global
int main()
{
int m=20; //local to main
{ int k=m;
int m=30;
cout<<”we are in inner block”<<endl;
cout<<”k=”<<k<<endl;
cout<<”m=”<<m<<endl;
cout<<”::m=”<<::m<<endl;
} return 0;
}
8. Standard Template Library (STL
09/04/138 VIT - SCSE
It is a software library partially included in the C++ Standard
Library.
It provides containers, iterators, algorithms, and functors.
More specifically, the C++ Standard Library is based on the
STL published by SGI.
(Silicon Graphics Computer Systems or SGCS) was a
manufacturer of high-performance computing solutions,
including computer hardware and software, founded in 1981
by Jim Clark and Abbey Silverstone.
9. 09/04/139 VIT - SCSE
C++ Standard Library
ios
iostream
iomanip
fstream
sstream
Standard Template Library
vector
deque
list
map
set
stack
Queue
Vector is a class template in the C++ Standard Template
Library, which functions like a dynamic array.
10. 09/04/139 VIT - SCSE
C++ Standard Library
ios
iostream
iomanip
fstream
sstream
Standard Template Library
vector
deque
list
map
set
stack
Queue
Vector is a class template in the C++ Standard Template
Library, which functions like a dynamic array.