Upcoming SlideShare
×

# 6 pointers functions

236

Published on

pointers functions

Published in: Technology, Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
236
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
31
0
Likes
0
Embeds 0
No embeds

No notes for slide

### 6 pointers functions

1. 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;
2. 2. 09/04/132 VIT - SCSE #include<iostream.h> #include<conio.h> void main() { float average(float x,float y, float z); float a,b,c,avg; float (*p)(float x,float y,floatz); p=&average; cout<<”Enter three numbers”; cin>>a>>b>>c; avg=(*p)(a,b,c); cout<<”Average=”<<avg; getch(); } float average(float x,float y,floatz) { float temp; temp=(x+y+z)/3.0; return(temp); }
3. 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. 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];
5. 5. Pointers to Pointers 09/04/135 VIT - SCSE Int a; Int *p; Int **q;
6. 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. 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. 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. 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. 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.
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.