-
Notifications
You must be signed in to change notification settings - Fork 0
/
functionalPointer.cpp
44 lines (33 loc) · 988 Bytes
/
functionalPointer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// #include<iostream>
// using namespace std;
// int getTwo(){
// return 2;
// }
// void intresting(){
// puts("I am intresting");
// }
// int main(){
// int hello = getTwo();
// void (*pointstoIntresting)() = intresting; // when we call or write a function( with astrick) with pointer always have an () around it
// // if we put () at end of intresting function it actually run it
// cout << hello << endl;
// pointstoIntresting();
// (*pointstoIntresting)(); // for run it again we need * and wrap it into parenthesis
// return 0;
// }
// NULL POINTER OR nullptr
#include<iostream>
using namespace std;
void printval(int a){
printf("Integer value is: %d\n", a);
}
void printval(double b){
printf("Double value is: %f\n", b);
}
void printval(int * a){
printf("Pointer value is: %p\n", a);
}
int main(){
printval(nullptr); // cpp have its own way to handle null property using nullptr
return 0;
}